2 Replies Latest reply on Sep 18, 2018 2:56 AM by vokail

    Websocket default timeout

    vokail

      This question is about 12.0.0.Final profile COMMUNITY and is about websocket default timeout (seems to be 60 seconds).

      From my findings, this configuration is in Configuration: Subsystems    Subsystem: Web/HTTP - Undertow    Settings: HTTP, under http server - Default sever there is the property "No request timeout" (see here: WildFly 12.0 Model Reference  property no-request-timeout )

       

      On my code there is no use for session.setMaxIdleTimeout, so my implementation uses default value of 60s.

       

      The problem is: how to extend this value ? If I change the propertie above, nothing seems to change (even after reload and restart)

        • 1. Re: Websocket default timeout
          jewellgm

          The timeout is configured on the servlet container.  There should be two ways to extend the value:

           

          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

            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