Can I get information about the connected nodes?

Hello, everyone,

I'm still pretty new to the topic Node-RED and especially custom nodes. At the moment I have a specific question, which I haven't found an answer to in the documentation yet and I'm asking for help:
Can I programmatically determine at runtime which other nodes are connected to my node via the input(s) and output(s)?

Something like output1.getConnectedNodes() or so?

Martin

the node has a property called wires which tells you where the output of the node is connected to (you get an array of node ids).

The bigger question is why you want to do that?
It is really against the core principles of Node-RED, so absolutely not recommended to do that.

1 Like

Thanks for your answer. Currently i am evaluating possibilities, so i am not sure if i will use the wires property. Maybe i just don't see it, but where do i find a documentation about the node object?

It is not documented as node's are not meant to care who they are connected to - they just call node.send(...) with the messages it wants passing on and the runtime takes care of routing the messages.

The fact there is an internal property called wires is not something a node's logic should rely on.

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