Linking nodes with wire

I have a question about linking nodes with wires.
For example I have three nodes A,B,C and this nodes are linked to node D with wire.
Every node has a unique internal id.
On node property "wires" of nodes A,B,C are the id of node D.
How can node D determine how many nodes are linked to his input ?
In this case 3.
Is there an easy JavaScript example for that ?

This isn't typically information a node should need to care about. In the runtime, there is no easy way for a node to know what it is wired to. You'd have to get ahold of the complete flow configuration and parse it out to figure out what is connected to what.

In the editor, there are APIs to find wires connected to any particular node you could use.

So it depends what you are trying to do, and why.

1 Like

Thanks Nick for answer,
Nodes A,B,C are sending boolean values.
Node D processed the boolean information and send the result if all nodes send.
For that I must know, how many nodes are connected to input.
For example node D checks for a AND, OR, XOR logical condition of nodes A,B,C

This node here node-red-contrib-boolean-logic (node) - Node-RED solves that having the number of messages as a config option

If you want to automate that, you have to be careful about partial deploys. Not sure a node is reinitialized if only a wire to it was added/removed.

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