# One node-red to another (different rpi's)

**URL:** https://discourse.nodered.org/t/one-node-red-to-another-different-rpis/3203
**Category:** General
**Created:** [17 September 2018 07:55 UTC](https://discourse.nodered.org/t/one-node-red-to-another-different-rpis/3203 "2018-09-17T07:55:12Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![matisok](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/matisok/32/3445_2.png) [@matisok](https://discourse.nodered.org/u/matisok)
#### Post date: [17 September 2018 07:55 UTC](https://discourse.nodered.org/t/one-node-red-to-another-different-rpis/3203/1 "2018-09-17T07:55:12Z")

</div>

I have one RPi with a hardware buttons wired up to it that I would like to speak to another RPi with an output (controlling a HW relay) - both running node-red obviously.

How do I send a message from the one rpi to the other? They are on the same network.

M

---

<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: [17 September 2018 07:57 UTC](https://discourse.nodered.org/t/one-node-red-to-another-different-rpis/3203/2 "2018-09-17T07:57:38Z")

</div>

I think using MQTT would be your best bet/solution as it's quick and easy to set-up.

---

<div class="post-metadata">

### Author: ![matisok](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/matisok/32/3445_2.png) [@matisok](https://discourse.nodered.org/u/matisok)
#### Post date: [17 September 2018 07:59 UTC](https://discourse.nodered.org/t/one-node-red-to-another-different-rpis/3203/3 "2018-09-17T07:59:03Z")

</div>

I will have a play with that - thanks.

Btw, the Rpi's are not on a internet accessible network. (dont know if that makes a difference to the solution).

---

<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: [17 September 2018 08:01 UTC](https://discourse.nodered.org/t/one-node-red-to-another-different-rpis/3203/4 "2018-09-17T08:01:33Z")

</div>

That shouldn't matter - in fact it's safer.

Have a look at installing Mosquitto (MQTT broker) on both RPi, then you could use the MQTT In and Out nodes to transfer data between the Pi(es).

I think you should find a number of articles on the forum about what you are trying to do.

---

<div class="post-metadata">

### Author: ![matisok](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/matisok/32/3445_2.png) [@matisok](https://discourse.nodered.org/u/matisok)
#### Post date: [17 September 2018 09:12 UTC](https://discourse.nodered.org/t/one-node-red-to-another-different-rpis/3203/5 "2018-09-17T09:12:26Z")

</div>

Thanks again. So I need a broker on both pi's I take it?

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [17 September 2018 09:18 UTC](https://discourse.nodered.org/t/one-node-red-to-another-different-rpis/3203/6 "2018-09-17T09:18:52Z")

</div>

> [@matisok](#):
>
> So I need a broker on both pi's I take it?

No, you do not need a broker on both Pis.

You can pick one of your Pis to run the broker, and connect to it from all of the Pis (including itself).

---

<div class="post-metadata">

### Author: ![matisok](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/matisok/32/3445_2.png) [@matisok](https://discourse.nodered.org/u/matisok)
#### Post date: [17 September 2018 09:30 UTC](https://discourse.nodered.org/t/one-node-red-to-another-different-rpis/3203/7 "2018-09-17T09:30:25Z")

</div>

Awesome. It works.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [18 September 2018 06:16 UTC](https://discourse.nodered.org/t/one-node-red-to-another-different-rpis/3203/8 "2018-09-18T06:16:04Z")

</div>

> [@matisok](#):
>
> Awesome. It works.

Just for reference, you could have used raw TCP, websocket or http nodes as well. All would work but undoubtedly, MQTT gives you a much more resilient solution without having to do the donkey work yourself.
