Websocket error handling

Hey all,

I'm currently using Node-RED to create a little user interface that can be used to control and monitor an application which controls things such as lighting, sound, pyrotechnics, etc...

The show control software has a web server which I can speak to over a websocket, when the websocket is closed I want to be able to display this on my dashboard "ERROR: Closed connection". When the websocket is closed I get the following error but isn't in the typically msg.payload format.

image

Usually the piece of software will just return the show status and depending on want it sends back I feed it through a switch and display it on my dashboard. So for example if it feeds back "QLC+API|getFunctionStatus|Running" then I know the show is running.

What would be the easiest way of converting that "An error occurred while sending: Error: WebSocket is not open: readyState 3 (CLOSED)" to a msg.payload so that I can feed it through my switch?

Would really appreciate any help!

Zac

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