diff --git a/src/WebSocket.php b/src/WebSocket.php index dddd52e..a09c4e8 100644 --- a/src/WebSocket.php +++ b/src/WebSocket.php @@ -110,7 +110,10 @@ function() use ($reusableUAException) { } }); - $stream->on('close', $this->_close); + $stream->on('close', function () { + $close = $this->_close; + $close(Frame::CLOSE_ABNORMAL, 'Underlying connection closed'); + }); $stream->on('error', function($error) { $this->emit('error', [$error, $this]);