Implemented writeAll and closeAll for groups

This commit is contained in:
2024-02-22 01:32:31 +01:00
parent b0aede55b9
commit ca84671f33
4 changed files with 31 additions and 2 deletions

View File

@ -252,8 +252,17 @@ class WebSocketConnection implements WebSocketInterface
*/
public function close()
{
// TODO send close
$this->outStream->close();
$this->inStream->close();
// TODO emit close event
}
public function closeWithReason(string $reason, int $code=1000)
{
// TODO send close
$payload = chr(($code >> 8) & 0xFF) . chr($code & 0xFF) . $reason;
$this->send(self::OP_CLOSE, $payload);
}
/**