This commit is contained in:
freek 2018-12-03 14:46:51 +01:00
parent f86b9b52ee
commit 6496d56b55
1 changed files with 19 additions and 19 deletions

View File

@ -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();