-
1. Re: Websocket default timeout
jewellgm Sep 17, 2018 1:17 PM (in response to vokail)The timeout is configured on the servlet container. There should be two ways to extend the value:
- Add a <session-timeout> element to your web.xml (How to configure the session timeout in servlet – Mkyong.com)
- In the standalone.xml, add a "default-session-timeout" attribute to the <servlet-container> element of the undertow subsystem.
In both cases, the value is specified in seconds. The first option will configure the timeout for that deployment only. The second option would be a global change, and would be across all deployments. If both options are used, the value in specified in the web.xml will apply for that deployment, and the global value will apply to all others.
Edit: The above suggestions may not work for websockets. You may also try to add a "maxIdleTime" init parameter to the servlet that utilizes the websockets. Unlike the other parameters above, this one is specified in milliseconds.
<init-param>
<param-name>maxIdleTime</param-name>
<param-value>120000</param-value>
</init-param>Edit 2: I looked at github to see how the WebsocketServlet is implemented within Undertow, both in master and the 1.4.x branch. The only init-param that is retrieved is "io.undertow.handler". There's a comment immediately after that which indicates that other init parameters still need to be handled. The code is invoking init on HttpServlet, but I doubt the base class does anything with websocket parameters.
undertow/WebSocketServlet.java at master · undertow-io/undertow · GitHub
I'm sorry for the several edits to this reply. I thought I had a potential answer each time, but I'm out of ideas.
-
2. Re: Websocket default timeout
vokail Sep 18, 2018 2:56 AM (in response to jewellgm)Thanks Greg for the effort, from my understanding, web.xml session-timeout is about the whole session, by default 30 minutes.
Websocket "sessions" are much smaller and by default 60 seconds (here I've found a mention about this: undertow/NodeConfig.java at ff4c9cf37872cb96070ba6a2fcbbaa6df291e390 · undertow-io/undertow · GitHub and also here undertow/Undertow.java at 4734359b69268fd993c36bbfe193d978a9c2a63b · undertow-io/undertow · GitHub )
At least I'm the only found this a little bit strange, I will open an issue on Jira asking for clarification, because seems to be a bug or at least a problem on documentation side