You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It took me a while to understand this, so I will leave this as a note for others:
My usecase: I use this library to interact with the Chrome DevTools. When I close a target (like a tab), Chrome closes the websocket stream automatically. When I try to close the websocket stream via the close() function, the client will throw an exception. I would expect that the close() function ignores an already closed stream, but instead it will try to write a 'closing frame' to it and fail.
The WebSocket\Client won't notice when the server closes the websocket.
Instead it will throw a WebSocket\ConnectionException with a message like
The important part is eof:true which means that the stream was closed.
Example: Start a websocket server and connect to it. While the client is connected, kill the server and inspect the client. Its member $is_connected is still true. Try to perform any action (ie. write or close) and it will throw the exception.
The text was updated successfully, but these errors were encountered:
Could it be because the server is not returning anything? When that happened to me, I found that receive_fragment() (base.php) was the culprit. After line 143 in base.php, I added:
If ( $data == "" ) {
if ( $this->huge_payload ) {
// sp we need to retreive the whole payload
$payload = $this->huge_payload;
$this->huge_payload = null;
return $payload;
}
return '';
}
It took me a while to understand this, so I will leave this as a note for others:
My usecase: I use this library to interact with the Chrome DevTools. When I close a target (like a tab), Chrome closes the websocket stream automatically. When I try to close the websocket stream via the
close()
function, the client will throw an exception. I would expect that theclose()
function ignores an already closed stream, but instead it will try to write a 'closing frame' to it and fail.The
WebSocket\Client
won't notice when the server closes the websocket.Instead it will throw a
WebSocket\ConnectionException
with a message likeThe important part is eof:true which means that the stream was closed.
Example: Start a websocket server and connect to it. While the client is connected, kill the server and inspect the client. Its member
$is_connected
is still true. Try to perform any action (ie. write or close) and it will throw the exception.The text was updated successfully, but these errors were encountered: