On nodejs, if the WebSocket broker is not running and createWebSocket() is called, the process crashes with a ECONNREFUSED error instead of trying to reconnect. Explicitly handling the error event prevents the crash and allows the close event handler to do it's reconnection magic.
On nodejs, if the WebSocket broker is not running and
createWebSocket()
is called, the process crashes with aECONNREFUSED
error instead of trying to reconnect. Explicitly handling theerror
event prevents the crash and allows theclose
event handler to do it's reconnection magic.