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
When connecting to the websocket server on a mobile phone and directly shutting down the network, neither the SetCloseHandler nor ReadMessage can listen for shutdown events or error messages @
Expected Behavior
Connect your phone to the WebSocket server and directly shut down the network to listen for client exit events
Steps To Reproduce
Run the WS server, print the information in the SetCloseHandler on the server, and retrieve the incorrect information in the ReadMessage judgment
Android phone links to ws server
Shut down all networks on Android
The ws server did not print any messages
Anything else?
No response
The text was updated successfully, but these errors were encountered:
XuruiPro
changed the title
[BUG] <title>Mobile phone actively disconnects, websocket server cannot obtain shutdown event
[BUG] <title>Mobile phone actively disconnects from the network, websocket server cannot obtain shutdown event
Sep 24, 2024
XuruiPro
changed the title
[BUG] <title>Mobile phone actively disconnects from the network, websocket server cannot obtain shutdown event
[BUG] <title>Mobile phone actively disconnects from the network, websocket server cannot obtain close event
Sep 24, 2024
The close handler is called in response to a close message, not to a disconnect event. Your application will not receive any messages from the peer in the scenario you describe. Unless your application flushes messages before echoing the close message, SetCloseHandler is not for your application. Refer to the documentation for more details.
ReadMessage returns an error when the peer closes the underlying TCP connection, the peer sends a close message, or the read deadline is exceeded. Set a read deadline to ensure that last of these conditions triggers. The example applications in this repository show how to use the read deadline.
This issue provides no evidence that there's a bug in the package.
Is there an existing issue for this?
Current Behavior
When connecting to the websocket server on a mobile phone and directly shutting down the network, neither the SetCloseHandler nor ReadMessage can listen for shutdown events or error messages @
Expected Behavior
Connect your phone to the WebSocket server and directly shut down the network to listen for client exit events
Steps To Reproduce
Anything else?
No response
The text was updated successfully, but these errors were encountered: