Check which Websocket sessions are inactive

Asked

Viewed 243 times

1

How to check if a session is active, when the device that was connected to the Websocket server suddenly shut down?

For in this situation, if I use the method Session.isOpen() the return is true. I think the comeback should be false.

1 answer

1


The method isOpen() only indicates the status of the connection according to the Websocket protocol (i.e., if one of the sides did not close the connection, for example, with the method close server-side).

The issue of connectivity verification is up to your application. You can do this by implementing message exchanges PING / PONG or with the use of Control Frames ping / pong with the exact same purpose (recommend the way through the application because not all browsers support Control Frames all right).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.