I'm working on a custom node that connects to an external websocket. My problem right now is that after I restart node-red the external API gives me a "connection limit exceeded" message.
I think there's a few ways I need to change my code but one I need help with is how can I detect when node-red is closing so that I can make a disconnect() call?
you need to handle the 'close' event - this is triggered whenever the node is being stopped. That can be due to a new flow configuration being deployed, or the runtime stopping.