Refactored the statistics logger

This commit is contained in:
Alex Renoki 2020-08-17 21:17:00 +03:00
parent 5890659102
commit 09776a1828
3 changed files with 53 additions and 2 deletions

View File

@ -191,9 +191,13 @@ return [
| store them into an array and then store them into the database
| on each interval.
|
| You can opt-in to avoid any statistics storage by setting the logger
| to the built-in NullLogger.
|
*/
'logger' => BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger::class,
'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger::class,
// 'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger\NullStatisticsLogger::class,
/*
|--------------------------------------------------------------------------

View File

@ -0,0 +1,47 @@
<?php
namespace BeyondCode\LaravelWebSockets\Statistics\Logger;
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager;
use Clue\React\Buzz\Browser;
use Ratchet\ConnectionInterface;
class NullStatisticsLogger implements StatisticsLogger
{
/** @var \BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager */
protected $channelManager;
/** @var \Clue\React\Buzz\Browser */
protected $browser;
public function __construct(ChannelManager $channelManager, Browser $browser)
{
$this->channelManager = $channelManager;
$this->browser = $browser;
}
public function webSocketMessage(ConnectionInterface $connection)
{
//
}
public function apiMessage($appId)
{
//
}
public function connection(ConnectionInterface $connection)
{
//
}
public function disconnection(ConnectionInterface $connection)
{
//
}
public function save()
{
//
}
}