Apache Tomcat Server(8.0.39)のセッションタイムアウトが30分(web.xmlで設定)になっているため、30秒後に切断されたWebocketを停止するように設定できません分。ランタイム2.4.8とJavascript 2.3.5を使用するAtmospheric websocket Tomcat8によって切断されました
私が手のメッセージは次のとおりです。
Websocket closed, reason: This connection was established under an
authenticated HTTP session that has ended. - wasClean: true
Atmosphere: Firing onClose (closed case)
reasonPhrase:"maxReconnectOnClose reached"
私はクライアントとサーバーの両方のハートビートを使用しています。サーバーは60秒ごとにハートビートを送信しますが、これはTomcatセッションが30分でタイムアウトするのを止めるものではありません。
ここで概説として私はMAX_INACTIVITYを使用して試してみた:
https://github.com/Atmosphere/atmosphere/issues/2250
<init-param>
<param-name>org.atmosphere.cpr.AtmosphereInterceptor</param-name>
<param-value>o.a.interceptor.IdleResourceInterceptor</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.session.maxInactiveInterval</param-name>
<param-value>3600000</param-value>
</init-param>
<init-param>
<param-name>o.a.cpr.CometSupport.maxInactiveActivity</param-name>
<param-value>3600000</param-value>
</init-param>
しかし、これも同様に無視され、TomcatがWebSocketをを閉じます。
AtmosphereでHttpセッションに触れ、Webソケットを閉じるのを止める方法はありますか?
基本設定:
@WebSocketHandlerService(path = "/async/chat", broadcasterCache =
UUIDBroadcasterCache.class)
public class ChatServer extends WebSocketHandlerAdapter {}
Javascriptを:
request.url = 'async/chat';
request.contentType = 'application/json';
request.transport = 'websocket';
request.fallbackTransport = 'websocket';
request.maxReconnectOnClose = 5;
request.enableProtocol = true;
request.trackMessageLength = true;
request.timeout = 3600000;
request.logLevel = 'debug';
のweb.xml:
<servlet>
<description>AtmosphereServlet</description>
<servlet-name>AtmosphereServlet</servlet-name>
<servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
<init-param>
<param-name>org.atmosphere.cpr.packages</param-name>
<param-value>atnf.jportal.websocket</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.AtmosphereInterceptor</param-name>
<param-value>o.a.client.TrackMessageSizeInterceptor</param-value>
</init-param>
<init-param>
<param-name>
o.a.i.HeartbeatInterceptor.clientHeartbeatFrequencyInSeconds
</param-name>
<param-value>120</param-value>
</init-param>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>AtmosphereServlet</servlet-name>
<url-pattern>/async/*</url-pattern>
</servlet-mapping>