Implemented writeAll and closeAll for groups
This commit is contained in:
@ -61,8 +61,20 @@ class ConnectionGroup implements EventEmitterInterface, IteratorAggregate, Count
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function write(string $payload)
|
||||
public function writeAll(string $payload)
|
||||
{
|
||||
|
||||
foreach ($this->connections as $connection) {
|
||||
if ($connection->isWritable()) {
|
||||
$connection->write($payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function closeAll(string $reason, int $code=1001)
|
||||
{
|
||||
foreach ($this->connections as $connection) {
|
||||
$connection->closeWithReason($reason, $code);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user