BH pusher

This commit is contained in:
Blax Software 2025-01-19 09:01:22 +01:00
parent 87bf0ae05e
commit 095894da1e
2 changed files with 10 additions and 5 deletions

View File

@ -25,7 +25,10 @@ class PusherMessageFactory
{
$payload = json_decode($message->getPayload());
return Str::startsWith($payload->event, 'pusher.')
return (
Str::startsWith($payload->event, 'pusher.')
|| Str::startsWith($payload->event, 'pusher:')
)
? new PusherChannelProtocolMessage($payload, $connection, $channelManager)
: new PusherClientMessage($payload, $connection, $channelManager);
}

View File

@ -61,8 +61,10 @@ class Handler implements MessageComponentInterface
}
}
public function onMessage(ConnectionInterface $connection, MessageInterface $message)
{
public function onMessage(
ConnectionInterface $connection,
MessageInterface $message
) {
if (! isset($connection->app)) {
return;
}
@ -356,7 +358,7 @@ class Handler implements MessageComponentInterface
$socket_id = $connection->socketId;
// if not in $channel_connections add it
if (strpos($message['event'], ':subscribe') !== false) {
if (strpos($message['event'], '.subscribe') !== false) {
if (! isset($this->channel_connections[$channel_name])) {
$this->channel_connections[$channel_name] = [];
}
@ -376,7 +378,7 @@ class Handler implements MessageComponentInterface
);
}
if (strpos($message['event'], ':unsubscribe') !== false) {
if (strpos($message['event'], '.unsubscribe') !== false) {
if (isset($this->channel_connections[$channel_name])) {
$this->channel_connections[$channel_name] = array_diff($this->channel_connections[$channel_name], [$socket_id]);
}