Websocket crashes node-red

I have a websocket connected to a sky box, when the sky box disconnects (ie I switch it off). it crashes node-red. I have a hearbeat set Disabling the hearbeat stops the error/crash. Should this be a bug? ie shouldn't it error more gracefully?
Node-red Version 2.1.3

Here is the log.

17 Nov 13:23:13 - [red] Uncaught Exception:
17 Nov 13:23:13 - [error] Error: WebSocket is not open: readyState 0 (CONNECTING)

at WebSocket.ping (/usr/src/node-red/node_modules/ws/lib/websocket.js:275:13)
at Timeout._onTimeout (/usr/src/node-red/node_modules/@node-red/nodes/core/network/22-websocket.js:118:32)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-red-docker@2.1.3 start: `node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"`
npm ERR! Exit status 1


npm ERR! Failed at the node-red-docker@2.1.3 start script.

And the flow

[{"id":"483143fe0fdf9889","type":"websocket in","z":"337ab9fcb061d1af","name":"","server":"","client":"8fef0e85b64534eb","x":370,"y":460,"wires":[["03e1d48e7eb0ca5b"]]},{"id":"03e1d48e7eb0ca5b","type":"json","z":"337ab9fcb061d1af","name":"","property":"payload","action":"","pretty":false,"x":670,"y":460,"wires":[["9adf4e94a29f48cd"]]},{"id":"9adf4e94a29f48cd","type":"debug","z":"337ab9fcb061d1af","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":460,"wires":[]},{"id":"8fef0e85b64534eb","type":"websocket-client","path":"ws://192.168.1.244:9006/as/system/status","tls":"","wholemsg":"false","hb":"10"}]

Yes, this should be handled better. Having built-in support for websocket pings is a relatively new feature - it would appear there's a timing window here that has exposed some missing error handling.

Can you raise an issue on github with details? Sign in to GitHub · GitHub

Done. Thanks

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.