# Websocket error handling

**URL:** <https://discourse.nodered.org/t/websocket-error-handling/42600>\
**Category:** General\
**Created:** [13 March 2021 23:58 UTC](https://discourse.nodered.org/t/websocket-error-handling/42600 "2021-03-13T23:58:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BelgianWaffle](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@BelgianWaffle](https://discourse.nodered.org/u/BelgianWaffle)\
**Post date:** [13 March 2021 23:58 UTC](https://discourse.nodered.org/t/websocket-error-handling/42600/1 "2021-03-13T23:58:55Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/6/86f9e46bea3f42a4825e56408eb454d4252cc801.png)

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.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/8/588208d01c7c62711ca40965da878ce5927a7439.png)

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 May 2021 23:59 UTC](https://discourse.nodered.org/t/websocket-error-handling/42600/2 "2021-05-12T23:59:30Z")

</div>

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