错误:socket与socket.io挂起

时间:2013-11-28 02:11:00

标签: node.js socket.io

使用Socket.IO,我在服务器端出错如下:

  

警告::错误:套接字挂断       在createHangUpError(http.js:1360:15)       在ServerResponse.OutgoingMessage._writeRaw(http.js:507:26)       在ServerResponse.OutgoingMessage._send(http.js:476:15)       在ServerResponse.OutgoingMessage.write(http.js:749:16)       在XHRPolling.doWrite(node_modules \ socket.io \ lib \ transports   \ XHR-polling.js:67:17)       在XHRPolling.HTTPPolling.write(node_modules \ socket.io \ lib \   运输\ HTTP-polling.js:132:82       在XHRPolling.Transport.onDispatch(node_modules \ socket.io \ l   IB \ transport.js:222:10)       在Manager.onDispatch(\ node_modules \ socket.io \ lib \ manager.js   :392:31)       在SocketNamespace.packet(\ node_modules \ socket.io \ lib \ namesp   ace.js:156:16)       在SocketNamespace.emit(\ node_modules \ socket.io \ lib \ namespac   e.js:188:15)       at \ gbin1platform \ server-version1-broadcast-20131016.js:263:2   9       在Client.get(\ node_modules \ socket.io \ lib \ stores \ memory.js:8   6:3)       在Socket.get(\ node_modules \ socket.io \ lib \ socket.js:258:14)

我在下面添加代码来捕获套接字挂起错误,否则应用程序将退出:

process.on('uncaughtException', function (exception) {
  // handle or ignore error
  error(exception.stack);
});

但是使用上面的代码,它无法真正处理套接字handup错误,只能确保应用程序不会崩溃,代码将不再起作用。我怎样才能真正解决上述错误?

0 个答案:

没有答案