# communication between node red servers

**URL:** <https://discourse.nodered.org/t/communication-between-node-red-servers/85224>\
**Category:** General\
**Created:** [5 February 2024 18:58 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224 "2024-02-05T18:58:49Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![RafaBravo](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@RafaBravo](https://discourse.nodered.org/u/RafaBravo)\
**Post date:** [5 February 2024 18:58 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224/1 "2024-02-05T18:58:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [5 February 2024 19:02 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224/2 "2024-02-05T19:02:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 February 2024 19:38 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224/3 "2024-02-05T19:38:03Z")

</div>

> [@RafaBravo](#):
>
> I've tried via MQTT, any other ideas?

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

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 February 2024 19:42 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224/4 "2024-02-05T19:42:57Z")

</div>

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

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.

---

<div class="post-metadata">

**Author:** ![Madjarx](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/madjarx/32/87412_2.png) [@Madjarx](https://discourse.nodered.org/u/Madjarx)\
**Post date:** [5 February 2024 22:36 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224/5 "2024-02-05T22:36:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Madjarx](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/madjarx/32/87412_2.png) [@Madjarx](https://discourse.nodered.org/u/Madjarx)\
**Post date:** [5 February 2024 22:36 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224/6 "2024-02-05T22:36:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [6 February 2024 04:12 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224/7 "2024-02-06T04:12:53Z")

</div>

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

Craig

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [6 February 2024 05:58 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224/8 "2024-02-06T05:58:46Z")

</div>

For long distance: LORA WAN  
For all distances: Telegram

Depending on what kind of message contents you need to communicate

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [6 February 2024 08:21 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224/9 "2024-02-06T08:21:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RafaBravo](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@RafaBravo](https://discourse.nodered.org/u/RafaBravo)\
**Post date:** [6 February 2024 08:34 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224/10 "2024-02-06T08:34:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 May 2024 08:35 UTC](https://discourse.nodered.org/t/communication-between-node-red-servers/85224/11 "2024-05-06T08:35:33Z")

</div>

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