andrewn / neue-radio

Neue Radio: Prototype connected object using web technologies
10 stars 6 forks source link

Explicitly handle WebSocket errors as this crashes the process on node #51

Closed andrewn closed 6 years ago

andrewn commented 6 years ago

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.