1

在服务器崩溃或间歇性网络故障后,Atmosphere Web 套接字客户端能够重新连接到服务器并接收消息。但是,大气长轮询客户端(IE8)无法重新连接。

我的应用程序是一个订阅主题并显示所有应用程序事件的实时事件浏览器。Chrome 和 Firefox 运行良好,但不幸的是,我们仍然需要支持 IE8,因此 WebSocket 和长轮询之间的一致行为至关重要。我在这里想念什么?这是气氛错误吗?

如何复制

  1. 下载气氛聊天示例 v2.0.3 http://search.maven.org/#artifactdetails%7Corg.atmosphere.samples%7Catmosphere-chat%7C2.0.0%7Cwar

  2. 修改 application.js 以使用长轮询并以 5 秒的间隔永久重新连接。

    传输:“长轮询”
    重新连接:true,
    maxReconnectOnClose:Number.MAX_VALUE

  3. 启动 Tomcat 服务器并开始聊天

  4. 突然停止Tomcat
  5. 启动Tomcat
  6. 打开另一个浏览器并发送一些消息。
  7. 原始浏览器不会收到消息。

[长轮询:不工作]

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} 

谢谢!

4

0 回答 0