Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
fix unsubscribeFromAllChannels / stale connections
Browse files Browse the repository at this point in the history
the `each->` call silently ran only for the first channel leading to
users on other channels seeming randomly not getting unsubscribed,
stale connections, a frustrated dev and a fishy smell all over the place.

after some serious hours of debugging and searching for this sneaky bug
the websocket-world is now a better place ;)
  • Loading branch information
simonbuehler committed Mar 4, 2021
1 parent efb3aa8 commit 6b6197f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ChannelManagers/LocalChannelManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ public function unsubscribeFromAllChannels(ConnectionInterface $connection): Pro

$this->getLocalChannels($connection->app->id)
->then(function ($channels) use ($connection) {
collect($channels)->each->unsubscribe($connection);
collect($channels)
->each(function (Channel $channel) use ($connection) {
$channel->unsubscribe($connection);
});

collect($channels)
->reject->hasConnections()
Expand Down

0 comments on commit 6b6197f

Please sign in to comment.