snapview/tungstenite-rs

simple example to show how to detect websocket user close connection on server side

CarbonPool opened this issue · 1 comments

I'm a newbie and don't know much about tcp system, can you help me how to detect websocket close

When reading or writing a message, the function will return an error if something goes wrong. You can treat it as a closed connection.

Specifically, the Error::ConnectionClosed is a good indicator that the connection got closed gracefully.

Our docs on docs.rs try to document such things well.