From 6496d56b556097071624f54d9871b23b9b3ea2d8 Mon Sep 17 00:00:00 2001 From: freek Date: Mon, 3 Dec 2018 14:46:51 +0100 Subject: [PATCH] nitpick --- src/Console/StartWebSocketServer.php | 38 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Console/StartWebSocketServer.php b/src/Console/StartWebSocketServer.php index 215bbfd..7965975 100644 --- a/src/Console/StartWebSocketServer.php +++ b/src/Console/StartWebSocketServer.php @@ -42,6 +42,25 @@ class StartWebSocketServer extends Command ->startWebSocketServer(); } + protected function configureStatisticsLogger() + { + $handler = new HttpClientAdapter($this->loop); + + $client = new Client([ + 'handler' => HandlerStack::create($handler), + ]); + + app()->singleton('websockets.statisticslogger', function() use ($client) { + return new StatisticsLogger(app(ChannelManager::class, $client)); + }); + + $this->loop->addPeriodicTimer(60, function() { + StatisticsLogger::save($this->loop); + }); + + return $this; + } + protected function configureHttpLogger() { app()->singleton(HttpLogger::class, function() { @@ -75,25 +94,6 @@ class StartWebSocketServer extends Command return $this; } - protected function configureStatisticsLogger() - { - $handler = new HttpClientAdapter($this->loop); - - $client = new Client([ - 'handler' => HandlerStack::create($handler), - ]); - - app()->singleton('websockets.statisticslogger', function() use ($client) { - return new StatisticsLogger(app(ChannelManager::class, $client)); - }); - - $this->loop->addPeriodicTimer(60, function() { - StatisticsLogger::save($this->loop); - }); - - return $this; - } - protected function registerEchoRoutes() { WebSocketsRouter::echo();