Refactored the statistics logger
This commit is contained in:
parent
5890659102
commit
09776a1828
|
|
@ -191,9 +191,13 @@ return [
|
||||||
| store them into an array and then store them into the database
|
| store them into an array and then store them into the database
|
||||||
| on each interval.
|
| 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,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use BeyondCode\LaravelWebSockets\Statistics\Logger\StatisticsLogger as Statistic
|
||||||
use Illuminate\Support\Facades\Facade;
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger
|
* @see \BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger
|
||||||
* @mixin \BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger
|
* @mixin \BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger
|
||||||
*/
|
*/
|
||||||
class StatisticsLogger extends Facade
|
class StatisticsLogger extends Facade
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue