I'm a bit stuck with my node-red-contrib-onvif-nodes developments, which allows you to control an Onvif compliant IP camera from a Node-RED flow.
- An Onvif camera 'can' offer 1 or more different Onvif services (PTZ, recording, events, ...), so I have implemented multiple Onvif nodes. This means you can have multiple nodes in the flow, controlling the SAME camera.
- To avoid having to repeat the IP address, username, password ... over and over again in these nodes, I have introduced an Onvif config node. This way the configuration is entered once in the config node, and all other Onvif nodes can share the same config node. So far so good ...
- Now I want to refactor my code, so only the config node communicates with the camera. Otherwise all nodes need to request the entire Onvif configuration from the IP camera, resulting in a lot of useles communication overhead.
Summarized this should be the end result:
Since the communication coding would be inside my config node, the config node status will change in time (disconnected, connected, error, ...). Since I want to display this status in all my other nodes, all my nodes need to keep track of the config node status.
Is it correct if I implement this like this:
- My config node is an event emitter, which generates 'status' events (every time the status changes).
- All my other nodes start listening for those status events, as soon as those nodes are starting.
- All my other nodes unregister their listener, as soon as a node 'close' event occurs.
Or is it perhaps not allowed to have an event-listener mechanism between nodes in a flow? Of course this way I have some kind of communication between nodes, without a visual wire in the flow editor. But on the other hand, it is only a config node...
Or could I introduce some kind of problems (after a partial?? deploy). For example the config node listener collection becomes empty (without my other nodes knowing it), or that my nodes are removed but the config node is still calling their listeners. But perhaps this kind of situations are not possible???