Should I tell Apache Tomcat to open a connection to Websocket?

I am trying to run an Apache Tomcat Websocket Deployment . The problem is that the connection always closes after 30 seconds of inactivity.

Do I need to configure Tomcat so that it does not open a connection? If so, how can I do this? I tried to configure connectionTimeout in the Connector server.xml element for the HTTP protocol. It didn’t affect, but I don’t know if it just works because I didn’t set the protocol attribute to something specific to websocket (since I don’t know what this protocol declaration looks like).

Or this may be a client-side issue.

Thanks for the help,
Leo

edit: This problem was solved with Tomcat 7.0.28 ( error description , changelog )

+3
source share
5 answers

Tomcat has several problems with WebSocket, and one of them closes the connection after 20 seconds (this is the value of connectTimeout on the. XML server). Increase this value to work around the problem.

- Jeanfrancois

+4
source

I manage to open websocket endlessly. All you have to do is install connectionTimeoutin server.xmlApache to minus one ( connectionTimeout="-1"). This solved my problem. :) ref:

+4
source

, ping /. , -.

, , .

+1

SET IN SERVER.XML

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="999999"
           redirectPort="8443" />
0

connectionTimeout server.xml, websocket. getReadTimeout - , websocket . , - 2 (2 * 60 * 1000), . : - ( ), -1.

@Override
public int getReadTimeout() {
    return 2*60*1000;
}

. . tomcat websocket

0

All Articles