WebSocket connection silently drops

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

WebSocket connection silently drops

Christopher Dodunski-4
Hi,

I have a desktop application that, using the org.glassfish.tyrus
WebSocket implementation, connects and talks with a parent web
application running on Tomcat.  All runs well for a while but, after
data transfer falls quiet for a few minutes, the connection gets
silently dropped (nothing in the logs).

The ServerEndpoint onOpen() method sets the session to never timeout:
session.setMaxIdleTimeout(0).  But this hasn't had the desired effect.

I've not (yet) implemented a game of ping pong to keep connections alive
over long periods of time.  Still, I'd like to know why connections
consistently get dropped after just a matter of minutes, and whether
this can be resolved with a simple configuration change.

Web.xml is configured to keep sessions alive for 720 minutes, so the
problem is not there.

     <session-config>
         <session-timeout>720</session-timeout>
     </session-config>

WebSocket connections are handled by Tomcat port 8080, and as you can
see this is set in server.xml to timeout after just 20 seconds.  I
haven't tried extending this for fear it may have undesirable side
effects.  Anyway, connections are dropping after several minutes, not 20
seconds.

     <Connector URIEncoding="UTF-8" port="8080" address="127.0.0.1"
protocol="HTTP/1.1"
                connectionTimeout="20000"
                redirectPort="8443" />

Any suggestions much appreciated.

Regards,

Chris.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: WebSocket connection silently drops

Christopher Dodunski-4
It turns out that I was premature in concluding connections were
silently getting dropped.

I left the client application running for another quarter hour after it
stopped displaying message updates from the server.  On shutting it
down, the server immediately recorded that the client had just
disconnected.  This indicates that the WebSocket connection is not being
silently dropped afterall, rather the client is becoming deaf to inbound
messages after a few minutes.

Exactly why this is is a mystery.  But evidently it is a Tyrus rather
than a Tomcat or network issue (they communicate across the internet, to
answer your earlier question).

Regards,

Chris.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]