From 059c52127003225280c8f8ec6658a382a947a9da Mon Sep 17 00:00:00 2001 From: freek Date: Tue, 27 Nov 2018 21:42:17 +0100 Subject: [PATCH] commit --- src/WebSockets/Channels/ChannelManager.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/WebSockets/Channels/ChannelManager.php b/src/WebSockets/Channels/ChannelManager.php index b8cd4f4..9f4e22f 100644 --- a/src/WebSockets/Channels/ChannelManager.php +++ b/src/WebSockets/Channels/ChannelManager.php @@ -51,8 +51,14 @@ class ChannelManager return; } + /** + * Remove the connection from all channels. + */ collect($this->channels[$connection->client->appId])->each->unsubscribe($connection); + /** + * Unset all channels that have no connections so we don't leak memory. + */ collect($this->channels[$connection->client->appId]) ->reject->hasConnections() ->each(function (Channel $channel, string $channelId) use ($connection) {