我正在使用 socket.io 运行 express(通过 nginx 代理),几分钟后(应用程序在一段时间内工作正常)控制台抛出这个:
events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: socket hang up
at createHangUpError (http.js:1360:15)
at ServerResponse.OutgoingMessage._writeRaw (http.js:507:26)
at ServerResponse.OutgoingMessage._send (http.js:476:15)
at ServerResponse.OutgoingMessage.write (http.js:749:16)
at XHRPolling.doWrite (/home/xyz/chat/node_modules/socket.io/lib/transports/xhr-polling.js:67:17)
at XHRPolling.HTTPPolling.write (/home/xyz/chat/node_modules/socket.io/lib/transports/http-polling.js:132:8)
at XHRPolling.Transport.onDispatch (/home/xyz/chat/node_modules/socket.io/lib/transport.js:222:10)
at Socket.dispatch (/home/xyz/chat/node_modules/socket.io/lib/socket.js:230:38)
at Socket.packet (/home/xyz/chat/node_modules/socket.io/lib/socket.js:214:10)
at Socket.emit (/home/xyz/chat/node_modules/socket.io/lib/socket.js:368:15)
有什么想法吗?
最佳答案
如果您使用的是 node.js 版本 0.8.20,那么包括我在内的许多人都发现了这个错误。
https://github.com/LearnBoost/socket.io/issues/1160
将 node.js 升级到 0.8.21 版本可以解决这个问题。
关于Node.js(带 socket.io 和 express)抛出 "events.js:71 throw arguments[1];//Unhandled ' 错误事件”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15045730/