socket.io客户端在发送时断开连接

时间:2015-08-03 12:07:39

标签: javascript node.js socket.io

我有一个应用程序,客户端应该每分钟都向服务器发送一个对象。

大多数情况下,邮件不会到达服务器。但是,服务器会从客户端收到断开连接事件。

在客户端浏览器中,当应该发送对象时会显示这些消息。

XHR finished loading: GET "http://localhost:3000/socket.io/?EIO=3&transport=polling&t=1438601847651-2".16.Request.create @ socket.io-1.2.0.js:2Request @ socket.io-1.2.0.js:216.XHR.request @ socket.io-1.2.0.js:216.XHR.doPoll @ socket.io-1.2.0.js:217.Polling.poll @ socket.io-1.2.0.js:217.Polling.doOpen @ socket.io-1.2.0.js:213.Transport.open @ socket.io-1.2.0.js:112.Socket.open @ socket.io-1.2.0.js:1Socket @ socket.io-1.2.0.js:1Socket @ socket.io-1.2.0.js:13.Manager.open.Manager.connect @ socket.io-1.2.0.js:1(anonymous function) @ socket.io-1.2.0.js:1
socket.io-1.2.0.js:2 XHR finished loading: GET "http://localhost:3000/socket.io/?EIO=3&transport=polling&t=1438601847675-3&sid=6j2loOyIEXlIzwlwAAAC".16.Request.create @ socket.io-1.2.0.js:2Request @ socket.io-1.2.0.js:216.XHR.request @ socket.io-1.2.0.js:216.XHR.doPoll @ socket.io-1.2.0.js:217.Polling.poll @ socket.io-1.2.0.js:217.Polling.onData @ socket.io-1.2.0.js:2(anonymous function) @ socket.io-1.2.0.js:28.Emitter.emit @ socket.io-1.2.0.js:116.Request.onData @ socket.io-1.2.0.js:216.Request.onLoad @ socket.io-1.2.0.js:216.Request.create.xhr.onreadystatechange @ socket.io-1.2.0.js:2
socket.io-1.2.0.js:2 XHR finished loading: GET "http://localhost:3000/socket.io/?EIO=3&transport=polling&t=1438602315276-4".16.Request.create @ socket.io-1.2.0.js:2Request @ socket.io-1.2.0.js:216.XHR.request @ socket.io-1.2.0.js:216.XHR.doPoll @ socket.io-1.2.0.js:217.Polling.poll @ socket.io-1.2.0.js:217.Polling.doOpen @ socket.io-1.2.0.js:213.Transport.open @ socket.io-1.2.0.js:112.Socket.open @ socket.io-1.2.0.js:1Socket @ socket.io-1.2.0.js:1Socket @ socket.io-1.2.0.js:13.Manager.open.Manager.connect @ socket.io-1.2.0.js:1(anonymous function) @ socket.io-1.2.0.js:1
socket.io-1.2.0.js:2 XHR finished loading: GET "http://localhost:3000/socket.io/?EIO=3&transport=polling&t=1438602315303-5&sid=z7RLpEScG6Lj_cIgAAAE".

1 个答案:

答案 0 :(得分:0)

看看这篇文章:

Controlling the heartbeat timeout from the client in socket.io

由于超时时间太短,可能会超出套接字连接超时。尝试增加它,就像在上面的URL中的线程一样。

希望这会有所帮助。