From 3af42685667a0566b510c835f99b1451d3c7404c Mon Sep 17 00:00:00 2001 From: Johannes Tiefenbrunner Date: Thu, 13 Feb 2025 18:53:01 +0100 Subject: [PATCH] Emit close with reason 1006 to WebSocketConnection listeners when underlying stream emitted a close. --- src/WebSocketConnection.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/WebSocketConnection.php b/src/WebSocketConnection.php index 28e17df..c58af01 100644 --- a/src/WebSocketConnection.php +++ b/src/WebSocketConnection.php @@ -68,6 +68,9 @@ function (Frame $frame) { $this->messageBuffer = $mb; $stream->on('data', [$mb, 'onData']); + $stream->on('close', function () { + $this->emit('close', [1006, $this, '']); + }); } public function send($data)