BF presence count

This commit is contained in:
a6a2f5842 2025-09-19 07:58:57 +02:00
parent 2960c3a3f3
commit d77e38d6f4
1 changed files with 17 additions and 29 deletions

View File

@ -24,9 +24,8 @@ class OpenPresenceChannel extends Channel
{
parent::subscribe($connection, $payload);
$this->channelManager
->getLocalConnections()
->then(function ($connections) use ($connection) {
$connections = $this->getConnections();
$connection->send(json_encode([
'event' => 'presence.subscription_succeeded',
'channel' => $this->getName(),
@ -41,7 +40,6 @@ class OpenPresenceChannel extends Channel
]));
$this->informPresence($connection, $connections);
});
return true;
}
@ -54,21 +52,11 @@ class OpenPresenceChannel extends Channel
*/
public function unsubscribe(ConnectionInterface $connection): PromiseInterface
{
\Log::channel('websocket')->info('Presence unsub');
$truth = parent::unsubscribe($connection);
\Log::channel('websocket')->info('Presence unsub 1');
$this->informPresence($connection, $this->getConnections(), true);
return $this->channelManager
->getLocalConnections()
->then(function ($connections) use ($connection) {
\Log::channel('websocket')->info('Presence unsub 2 local conn');
$this->informPresence($connection, $connections, true);
})
->then(function () use ($truth) {
return $truth;
});
}
public function informPresence(