Upgrade to Jetty 9.4 (seriously) I would have expected for the java client, when a connection issue is detected, either the onClose or onError should occur. But if the connection is truely unused, then there wont be a detected issue on java until a read or write operation is attempted. Hence your ping/pong step (to trigger a read or write).
- Joakim Joakim Erdfelt / [email protected] On Thu, Jun 8, 2017 at 8:52 AM, Venkateswarlu Marripudi < [email protected]> wrote: > 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 > > _______________________________________________ > jetty-users mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > https://dev.eclipse.org/mailman/listinfo/jetty-users >
_______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
