Hi,
We have implemented a Jetty OSGI WebSocket Client that talks to a Jetty WebSocket Server. Version of the server and client is 9.2 . We have implemented WebSocketListener at the client side.
The client after establishing a connection waits for notifications from server - so if there is any connection failure it has to reconnect as soon as possible. When we have a network error , the onClose or onError methods are not invoked - realized that this is as per specification after checking in this forum and other places.
I then attempted to send periodic heartbeats using session.getRemote().setPing method. Even this method did not throw an exception ( or cause onError to be invoked ) when the network was disconnected. I am now planning to set a timer and then listen for the pong message , and if the pong does not arrive in reasonable time, infer that the connection is broken and re-establish it.
Is this the correct approach ? Also since we are using jetty 9.2 the WebSocketPingPongListener interface is not there - what is the best way to receive the pong message in the client side ?
Regards
Venkat