wip
This commit is contained in:
parent
5c93909f31
commit
6c96bb8edc
|
|
@ -72,19 +72,15 @@ class HttpStatisticsLogger implements StatisticsLogger
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->browser
|
$this
|
||||||
|
->browser
|
||||||
->post(
|
->post(
|
||||||
action([WebSocketStatisticsEntriesController::class, 'store']),
|
action([WebSocketStatisticsEntriesController::class, 'store']),
|
||||||
['Content-Type' => 'application/json'],
|
['Content-Type' => 'application/json'],
|
||||||
stream_for(json_encode($statistic->toArray()))
|
stream_for(json_encode($statistic->toArray()))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Reset connection and message count
|
$currentConnectionCount = $this->channelManager->getConnectionCount($appId);
|
||||||
$currentConnectionCount = collect($this->channelManager->getChannels($appId))
|
|
||||||
->sum(function ($channel) {
|
|
||||||
return count($channel->getSubscribedConnections());
|
|
||||||
});
|
|
||||||
|
|
||||||
$statistic->reset($currentConnectionCount);
|
$statistic->reset($currentConnectionCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,12 @@ class ChannelManager
|
||||||
return $this->channels[$appId] ?? [];
|
return $this->channels[$appId] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getConnectionCount(string $appId): int
|
||||||
|
{
|
||||||
|
return collect($this->getChannels($appId))
|
||||||
|
->sum->getSubscribedConnections();
|
||||||
|
}
|
||||||
|
|
||||||
public function removeFromAllChannels(ConnectionInterface $connection)
|
public function removeFromAllChannels(ConnectionInterface $connection)
|
||||||
{
|
{
|
||||||
if (!isset($connection->app)) {
|
if (!isset($connection->app)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue