在服务器崩溃或间歇性网络故障后,Atmosphere Web套接字客户端能够重新连接到服务器并接收消息。但是,大气长轮询客户端(IE8)无法重新连接。
我的应用是一个实时事件浏览器,可以订阅主题并显示所有应用程序事件。 Chrome和Firefox工作得很好,但不幸的是,我们仍然需要支持IE8,因此WebSocket和Long-Polling之间的一致行为至关重要。我在这里错过了什么?这是一个Atmosphere bug ??
如何重现
下载氛围聊天示例v2.0.3 http://search.maven.org/#artifactdetails%7Corg.atmosphere.samples%7Catmosphere-chat%7C2.0.0%7Cwar
修改application.js以使用长轮询并以5秒的间隔永久重新连接。
运输:'长轮询'
重新连接:真,
maxReconnectOnClose:Number.MAX_VALUE
启动Tomcat服务器并开始聊天
[长轮询:不工作]
onOpen called with {"url":"http://localhost:8080/atmosphere-chat/chat","contentType":"application/json","logLevel":"debug","transport":"long-polling","trackMessageLength":true,"reconnect":true,"maxReconnectOnClose":1.7976931348623157e+308,"reconnectInterval":5000,"enableXDR":true,"fallbackTransport":"long-polling"} atmosphere.js:2801
onMessage called. {"message":"Chrome","author":"Chrome","time":1381083093440} atmosphere.js:2801
onMessage called. {"message":"Hello","author":"Chrome","time":1381083099605} atmosphere.js:2801
<< Server Crashed>>
POST http://localhost:8080/atmosphere-chat/chat?X-Atmosphere-tracking-id=0cbdf60…sport=polling&X-Cache-Date=0&Content-Type=application/json&_=1381083105434 atmosphere.js:1750
_executeRequest atmosphere.js:1750
_pushAjaxMessage atmosphere.js:2197
_push atmosphere.js:2143
push atmosphere.js:2511
request.onClose application.js:111
_f atmosphere.js:2405
_invokeFunction atmosphere.js:2361
_invokeCallback atmosphere.js:2455
_invokeClose atmosphere.js:2417
_executeRequest.ajaxRequest.onabort atmosphere.js:1593
_clearState atmosphere.js:344
_executeRequest.ajaxRequest.onreadystatechange atmosphere.js:1652
Unable to connect to http://localhost:8080/atmosphere-chat/chat atmosphere.js:2801
GET http://localhost:8080/atmosphere-chat/chat?X-Atmosphere-tracking-id=0cbdf60…-Date=0&Content-Type=application/json&X-atmo-protocol=true&_=1381083099613 atmosphere.js:1750
_executeRequest atmosphere.js:1750
_reconnect atmosphere.js:1840
_executeRequest.ajaxRequest.onreadystatechange atmosphere.js:1735
<< Never Retries>>
[网络插座:工作]
Invoking executeWebSocket atmosphere.js:2801
Using URL: ws://localhost:8080/atmosphere-chat/chat?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.0.3-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json&X-atmo-protocol=true atmosphere.js:2801
Websocket successfully opened atmosphere.js:2801
onOpen called with with {"url":"http://localhost:8080/atmosphere-chat/chat","contentType":"application/json","logLevel":"debug","transport":"websocket","trackMessageLength":true,"reconnect":true,"maxReconnectOnClose":1.7976931348623157e+308,"reconnectInterval":5000,"enableXDR":true,"fallbackTransport":"long-polling"} atmosphere.js:2801
onMessage called. {"message":"Chrome","author":"Chrome","time":1381082675245} atmosphere.js:2801
onMessage called. {"message":"hello","author":"Chrome","time":1381082685115} atmosphere.js:2801
<< server crashed>>
WebSocket is already in CLOSING or CLOSED state. atmosphere.js:2296
Invoking executeWebSocket atmosphere.js:2801
Using URL: ws://localhost:8080/atmosphere-chat/chat?X-Atmosphere-tracking-id=3764cd2f-6338-4478-bf35-b9f5fa105c7e&X-Atmosphere-Framework=2.0.3-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=1381082719622&Content-Type=application/json&X-atmo-protocol=true atmosphere.js:2801
Invoking executeWebSocket atmosphere.js:2801
Using URL: ws://localhost:8080/atmosphere-chat/chat?X-Atmosphere-tracking-id=3764cd2f-6338-4478-bf35-b9f5fa105c7e&X-Atmosphere-Framework=2.0.3-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=1381082726651&Content-Type=application/json&X-atmo-protocol=true atmosphere.js:2801
Invoking executeWebSocket atmosphere.js:2801
Using URL: ws://localhost:8080/atmosphere-chat/chat?X-Atmosphere-tracking-id=3764cd2f-6338-4478-bf35-b9f5fa105c7e&X-Atmosphere-Framework=2.0.3-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=1381082733654&Content-Type=application/json&X-atmo-protocol=true atmosphere.js:2801
Invoking executeWebSocket atmosphere.js:2801
Using URL: ws://localhost:8080/atmosphere-chat/chat?X-Atmosphere-tracking-id=3764cd2f-6338-4478-bf35-b9f5fa105c7e&X-Atmosphere-Framework=2.0.3-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=1381082740657&Content-Type=application/json&X-atmo-protocol=true atmosphere.js:2801
<< server Restarted>>
Websocket successfully opened atmosphere.js:2801
onMessage called. {"message":"IE10","author":"IE10","time":1381082755699}
谢谢!