Search code examples
node.jsnode-red

How to send/pass message to next node using node identifier in node red?


I am building custom node for my flow. The custom node is working properly and sending message/result to next node using node.send(msg); where node=this. It's working properly when I use this node only once. Incase if i use the same node in multiple places in same flow. it sends the message always to one(last) node. I think the script lost context of nodes. i.e., where to send the message. So, I want to replace node.sent(msg) to getnode(node_id).send(msg) so that it will always send the message to proper node. I am new to node red.So, please pardon if I failed to explain the problem. If you need more details, please let me know, i will add. Any hint would be appreciable.


Solution

  • That indicates a problem with how you have created your node.

    The only way your node should be sending messages is by calling this.send(...).