How node.send() works

Published: | by Julian Knight Reading time ~1 min.
📖 Kb | 📎 Development | 🔖 Node-RED

Some detail not included in the documentation.

It is synchronous. See this discussion for details.

If you have code in a function node after a node.send(), it will not run until all downstream connected nodes have finished processing their sending routines. This is true of nodes further downstream as well.

Also see Issue 833 on GitHub

Another impact of this is that, because [msg’s may be passed by reference]({{ site.baseurl }}{% link nr-qa/msg-cloning.md %}) to downstream nodes, a subsequent node may alter the msg. This means that any processing after a node.send(msg) may be getting a msg object that has been altered.


comments powered by Disqus