Removing higher-order from collection-related tasks
This commit is contained in:
parent
3cf74c7a50
commit
1bb727f322
|
|
@ -179,7 +179,9 @@ class LocalChannelManager implements ChannelManager
|
||||||
});
|
});
|
||||||
|
|
||||||
collect($channels)
|
collect($channels)
|
||||||
->reject->hasConnections()
|
->reject(function ($channel) {
|
||||||
|
return $channel->hasConnections();
|
||||||
|
})
|
||||||
->each(function (Channel $channel, string $channelName) use ($connection) {
|
->each(function (Channel $channel, string $channelName) use ($connection) {
|
||||||
unset($this->channels[$connection->app->id][$channelName]);
|
unset($this->channels[$connection->app->id][$channelName]);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,9 @@ class Channel
|
||||||
public function broadcast($appId, stdClass $payload, bool $replicate = true): bool
|
public function broadcast($appId, stdClass $payload, bool $replicate = true): bool
|
||||||
{
|
{
|
||||||
collect($this->getConnections())
|
collect($this->getConnections())
|
||||||
->each->send(json_encode($payload));
|
->each(function ($connection) use ($payload) {
|
||||||
|
$connection->send(json_encode($payload));
|
||||||
|
});
|
||||||
|
|
||||||
if ($replicate) {
|
if ($replicate) {
|
||||||
$this->channelManager->broadcastAcrossServers($appId, null, $this->getName(), $payload);
|
$this->channelManager->broadcastAcrossServers($appId, null, $this->getName(), $payload);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue