You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Christopher Dodunski (Apache Tomcat)" <Ch...@christopher.net.nz> on 2020/09/13 09:30:08 UTC

WebSocket connection silently drops

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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org