简体   繁体   中英

node websocket-server — ETIMEDOUT error

I'm using this with expressjs, is there a good way to catch this error:

WS: 179575738318 end WS: 179575738318 stateChange: 4 -> 5 WS: 179575738318 socket closed WS: 179575738318 stateChange: 5 -> 6 Manager: Detached: (11) WS: 179575734517 end WS: 179575734517 stateChange: 4 -> 5 WS: 179575734517 socket closed WS: 179575734517 stateChange: 5 -> 6 Manager: Detached: (10) WS: 179575734515 error Error: ETIMEDOUT, Connection timed out

node.js:134 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: ETIMEDOUT, Connection timed out at Socket._readImpl (net.js:163:14) at Socket._onReadable (net.js:633:22) at IOWatcher.onReadable [as callback] (net.js:177:10)

I add in this clause, so this should work?

ws.websocketServer.on('error', function (error) { console.log('Error: ' + error); });

ws.websocketServer.on('error', function (error) { console.log('Error: ' + error); }); did it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM