Merge branch 'master' of github.com:beyondcode/laravel-websockets

This commit is contained in:
Marcel Pociot 2018-11-27 21:46:13 +01:00
commit 2a33b5ec1f
2 changed files with 7 additions and 1 deletions

View File

@ -56,7 +56,7 @@ class WebsocketLogger extends Logger implements MessageComponentInterface
$appId = $connection->client->appId ?? 'Unknown app id';
$message = "{$appId}: exception `{$exceptionClass}` thrown: `{$exception->getMessage()}`";
$message = "{$appId}: exception `{$exceptionClass}` thrown: `{$exception->getMessage()}`.";
if ($this->verbose) {
$message .= $exception->getTraceAsString();

View File

@ -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) {