diff --git a/config/websockets.php b/config/websockets.php index 6a2e7f0..a4517cf 100644 --- a/config/websockets.php +++ b/config/websockets.php @@ -81,6 +81,12 @@ return [ */ 'model' => \BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry::class, + /** + * The Statistics Logger will, by default, handle the incoming statistics, store them + * and then release them into the database on each interval defined below. + */ + 'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger::class, + /* * Here you can specify the interval in seconds at which statistics should be logged. */ diff --git a/src/Console/StartWebSocketServer.php b/src/Console/StartWebSocketServer.php index e68767c..1f636c7 100644 --- a/src/Console/StartWebSocketServer.php +++ b/src/Console/StartWebSocketServer.php @@ -61,7 +61,9 @@ class StartWebSocketServer extends Command $browser = new Browser($this->loop, $connector); app()->singleton(StatisticsLoggerInterface::class, function () use ($browser) { - return new HttpStatisticsLogger(app(ChannelManager::class), $browser); + $class = config('websockets.statistics.logger') ?: \BeyondCode\LaravelWebSockets\Statistics\Logger::class; + + return new $class(app(ChannelManager::class), $browser); }); $this->loop->addPeriodicTimer(config('websockets.statistics.interval_in_seconds'), function () {