Fixed presence channel broadcasting

This commit is contained in:
Alex Renoki 2020-09-11 08:34:21 +03:00
parent 6a23016f98
commit 76bc4820a0
1 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,7 @@
namespace BeyondCode\LaravelWebSockets\Channels; namespace BeyondCode\LaravelWebSockets\Channels;
use BeyondCode\LaravelWebSockets\DashboardLogger;
use BeyondCode\LaravelWebSockets\Server\Exceptions\InvalidSignature; use BeyondCode\LaravelWebSockets\Server\Exceptions\InvalidSignature;
use Ratchet\ConnectionInterface; use Ratchet\ConnectionInterface;
use stdClass; use stdClass;
@ -19,7 +20,9 @@ class PresenceChannel extends PrivateChannel
*/ */
public function subscribe(ConnectionInterface $connection, stdClass $payload) public function subscribe(ConnectionInterface $connection, stdClass $payload)
{ {
parent::subscribe($connection, $payload); $this->verifySignature($connection, $payload);
$this->saveConnection($connection);
$this->channelManager->userJoinedPresenceChannel( $this->channelManager->userJoinedPresenceChannel(
$connection, $connection,
@ -48,6 +51,11 @@ class PresenceChannel extends PrivateChannel
(object) $memberAddedPayload, $connection->socketId, (object) $memberAddedPayload, $connection->socketId,
$connection->app->id $connection->app->id
); );
DashboardLogger::log($connection->app->id, DashboardLogger::TYPE_SUBSCRIBED, [
'socketId' => $connection->socketId,
'channel' => $this->getName(),
]);
} }
/** /**