I have found a way to set the idle timeout for Jetty 11 WebSocket connections programmatically by invoking factory.setIdleTimeout
in an implementation of the JettyWebSocketServlet.configure(JettyWebSocketServletFactory factory)
method. I wonder…
- if that’s the recommended approach, and
- whether the timeout value can be externalized, e.g. via an XML configuration file? As it seems, the following solution does not work for WebSockets:
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server"/></Arg>
<Set name="idleTimeout">90000</Set>
</New>
</Arg>
</Call>
</Configure>