fix unsubscribeFromAllChannels / stale connections

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 ;)
This commit is contained in:
Simon Bühler 2021-03-04 08:45:18 +01:00
parent efb3aa82b9
commit 6b6197f4f1
1 changed files with 4 additions and 1 deletions

View File

@ -173,7 +173,10 @@ class LocalChannelManager implements ChannelManager
$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()