communication between node red servers

Good afternoon, what would be the appropriate way to communicate 2 node-red servers? I've tried via MQTT, any other ideas?

There is
1, http request to a http in and response node
2, udp in and out
3, tcp in and out
4, websocket in and out

Does mqtt not do what you need? Generally it is the easiest way.

5, Email
6, NFS & file-in node
7, SSHFS and file-in node

MQTT seems to be the most elegant.
If the servers are on the same network run your own broker, otherwise use a cloud based broker.

Hmmm, i had an idea a while back that would have required this thing.

I'll try to give my best with this answer, but take it into consideration that i will display it in my own context

So the first thing would be to somehow get those 2 servers on the same network preferably, cus in that case, the possibilities are limitless, so if you can't get them in a docker-compose stack, something like dummy API endpoint would be the optimal solution imo

If you do have them running on the very same network of a sort, id implement some sort of broker, try looking at stuff like RabbitMQ, they have a simple-to-use broker that you can setup pretty quickly, and supports nodeJS. There prolly is an implementation of that broker in nodeRED also.

You could emit textual events maybe, and have some sort of "stack" / "queue" implementation where you could store those events and act upon them. Id say broker approach is versatile cus you can send all kinds of messages / events & include whatever data you want.

I'd try to abstract away the communication part itself though, maybe create a separate flow that would store the stuff in a global context maybe? Or maybe even build out a set of custom nodes that would fit your very needs. It wouldnt be that hard to build out

Also what other people suggested, UDP / TCP / HTTP is always a good idea also, shouldnt let you down. Might need to build a bit more robust but should do the trick.

And remember if they are not on the same network you can use one of the many SDN (Zerotier, Wireguard etc) to create a VPN between the nodes so they appear to be on the same network - Zerotier probably being the easiest to setup


For long distance: LORA WAN
For all distances: Telegram

Depending on what kind of message contents you need to communicate

Is there a reason why MQTT is not suitable for your needs?

It is very easy protocol to setup & use and a very reliable way to exchange information.
If the Node-RED servers are on the SAME network use a LOCAL mqtt broker.
If they are on DIFFERENT networks use a REMOTE broker.

1 Like

MQTT has worked very well for me, but I wanted to learn about other possibilities and try them. Thank you very much for the answers

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