大气框架中的长轮询间隔约为60秒。即使在AtmosphereRequest中设置了pollingInterval属性,请求也会在60秒后发送到服务器。如何在请求中设置pollingInterval?这是javascript中的请求: request:{ url : document.location.toString() + 'echo',
transport : 'websocket', fallbackTransport : 'long-polling', trackMessageLength : true, reconnect: true, pollingInterval :10, maxReconnectOnClose: Number.MAX\_VALUE, reconnectInterval: 10, connectTimeout: -1 }发布于 2015-01-31 07:11:08
在服务器端,在web.xml中,您可以设置以下两个初始参数条目:
<init-param>
<param-name>org.atmosphere.cpr.AtmosphereInterceptor</param-name>
<param-value>org.atmosphere.interceptor.HeartbeatInterceptor</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.interceptor.HeartbeatInterceptor.heartbeatFrequencyInSeconds</param-name>
<!-- value in seconds, default 60 -->
<param-value>10</param-value>
</init-param>欲了解更多信息,请访问:http://atmosphere.github.io/atmosphere/apidocs/org/atmosphere/interceptor/HeartbeatInterceptor.html
https://stackoverflow.com/questions/28021797
复制相似问题