diff --git a/src/Managers/ChannelManager.php b/src/Managers/ChannelManager.php index 6b57a03b..12624163 100644 --- a/src/Managers/ChannelManager.php +++ b/src/Managers/ChannelManager.php @@ -56,6 +56,14 @@ public function unsubscribe(Channel $channel, Connection $connection): void unset($this->connections[$this->application->id()][$channel->name()][$connection->id()]); } + /** + * Unsubscribe from a channel. + */ + public function unsub(string $channel, Connection $connection): void + { + unset($this->connections[$this->application->id()][$channel][$connection->id()]); + } + /** * Get all the channels. */ @@ -72,7 +80,7 @@ public function all(): Collection public function unsubscribeFromAll(Connection $connection): void { $this->channels()->each(function ($connections, $name) use ($connection) { - ChannelBroker::create($name)->unsubscribe($connection); + $this->unsub($name, $connection); }); }