diff --git a/src/ChannelManagers/LocalChannelManager.php b/src/ChannelManagers/LocalChannelManager.php index 3cacbf4f17..913744baea 100644 --- a/src/ChannelManagers/LocalChannelManager.php +++ b/src/ChannelManagers/LocalChannelManager.php @@ -179,7 +179,9 @@ public function unsubscribeFromAllChannels(ConnectionInterface $connection): Pro }); collect($channels) - ->reject->hasConnections() + ->reject(function ($channel) { + return $channel->hasConnections(); + }) ->each(function (Channel $channel, string $channelName) use ($connection) { unset($this->channels[$connection->app->id][$channelName]); }); diff --git a/src/Channels/Channel.php b/src/Channels/Channel.php index fd857e233f..7cc7f375a2 100644 --- a/src/Channels/Channel.php +++ b/src/Channels/Channel.php @@ -156,7 +156,9 @@ public function saveConnection(ConnectionInterface $connection) public function broadcast($appId, stdClass $payload, bool $replicate = true): bool { collect($this->getConnections()) - ->each->send(json_encode($payload)); + ->each(function ($connection) use ($payload) { + $connection->send(json_encode($payload)); + }); if ($replicate) { $this->channelManager->broadcastAcrossServers($appId, null, $this->getName(), $payload);