Check which Websocket sessions are inactive

1

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

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

    
asked by anonymous 14.08.2014 / 21:18

1 answer

1

The isOpen() method only indicates the status of the connection according to the WebSocket protocol. (That is, if one side did not close the connection, for example, with the close method on the server side.)

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

    
15.08.2014 / 01:22