I want to implement a node, which does some communication with a remote server. The server demands some sort of state handling by the client (which is my custom node).
Is it possible to get an event, when the node has been deleted in the editor? It would also be okay if this event emits on the next deployment of the flow. I would need to inform the server that the client is not available anymore at this point.
I did not find such event in the documentation and I am not aware of other nodes which implement similar things. Do you have some ideas to point me in the right direction?
The docs are your friend. If think the
close event is what you're looking for.
Sorry, I missed the
removed flag of the event. This should be okay for my use case.
Thanks for the fast response!
Do you intend to create a separate connection for each user node?
Otherwise I would look into using a config node and share the connection and state between multiple user nodes. An example of that is the MQTT core node.
Yes, actually I want to share a connection via configuration node between all of these nodes. But each node uses a unique topic/channel and needs to inform the server when the topic is not used anymore (via a special different topic/channel).
I tried to generalize the issue to not bother you with the nitty-gritty details.
Still thanks for the hint!
Ah, very similar to the MQTT nodes then. So you just need to hold the client connection in the config node, and register/deregister each user node on deploy/close. Should be straight forward.