Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty Websocket Client - unable to handle network errors

Hi

Thanks for the info. I tried to upgrade but there were too may dependencies so I am forced to work with the current version ( 9.2.15 ). I will plan for an upgrade soon - but will have to resolve this issue before that.

The behaviour that I am noticing is that when I do a sendPing ( after disconnecting the network ) , it does not throw an exception and also the onClose and onError events are not fired immediately. However I seem to get an onClose after about 15 minutes and subsequent pings fail immediately . The  idleTimeOut is much higher than 15 minutes. I am not able to understand what is happening. Is it possible to make it fail earlier ? 

I also tried sendString with and without callback. Even the sendString did not call the errorCallback ( immediately went to success call back ).

I need to know of the network failure within 30 sec to 1 min. Is there anything else I can do to get this info ?

Regards
Venkat  



On Thu, Jun 8, 2017 at 9:46 PM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
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 / joakim@xxxxxxxxxxx

On Thu, Jun 8, 2017 at 8:52 AM, Venkateswarlu Marripudi <venkateswarlu@xxxxxxxxxxxxx> 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
jetty-users@xxxxxxxxxxx
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
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top