# Websocket message

**URL:** <https://discourse.nodered.org/t/websocket-message/14789>\
**Category:** General\
**Created:** [26 August 2019 13:20 UTC](https://discourse.nodered.org/t/websocket-message/14789 "2019-08-26T13:20:41Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![lodv](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lodv/32/7963_2.png) [@lodv](https://discourse.nodered.org/u/lodv)\
**Post date:** [26 August 2019 13:20 UTC](https://discourse.nodered.org/t/websocket-message/14789/1 "2019-08-26T13:20:41Z")

</div>

Hello,

What is meant by the message: Cannot have two WebSocket listeners on the same path: ws/myapp in the debug window?  
I have multiple MQTT out nodes. Three nodes use the same IP address (of Raspberry Pi A) and one has another IP address (Raspberry Pi B)  
This other IP address belongs to a Raspberry Pi B where I want to control a GPIO node.  
I have also a MQTT in node on Raspberry Pi A, with the IP address of the Raspberry Pi A. The node out is located on Raspberry Pi B in order to send a string message.  
I hope I can make myself a bit clear. But everytime I deplore by application on Raspberry Pi A I get this message and I can't find out what it means.

Thank you for your help.

Yvonne

---

<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:** [26 August 2019 13:32 UTC](https://discourse.nodered.org/t/websocket-message/14789/2 "2019-08-26T13:32:42Z")

</div>

The message means what it says: you cannot have two websocket nodes listening on the same path. It has nothing to do with MQTT nodes.

What websocket nodes have you got?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [26 August 2019 13:37 UTC](https://discourse.nodered.org/t/websocket-message/14789/3 "2019-08-26T13:37:20Z")

</div>

You also sound as if you are trying to send a message directly between the two Pi's using MQTT.

MQTT is a pubsub protocol meaning you generally need a broker. What broker have you got installed?

---

<div class="post-metadata">

**Author:** ![lodv](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lodv/32/7963_2.png) [@lodv](https://discourse.nodered.org/u/lodv)\
**Post date:** [26 August 2019 14:19 UTC](https://discourse.nodered.org/t/websocket-message/14789/4 "2019-08-26T14:19:06Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/0ca7618946d463ffd7dc1546292fa701051ae4a0.png)  
As you can see they are disabled (if you call it disabled) and I use only 1 websocket. I also have 1 tab, so I really have no idea. Can I delete those websockets in the sidebar?  
Thank you for your help.

Yvonne

---

<div class="post-metadata">

**Author:** ![lodv](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lodv/32/7963_2.png) [@lodv](https://discourse.nodered.org/u/lodv)\
**Post date:** [26 August 2019 14:20 UTC](https://discourse.nodered.org/t/websocket-message/14789/5 "2019-08-26T14:20:03Z")

</div>

Mosquitto is the broker

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 August 2019 14:56 UTC](https://discourse.nodered.org/t/websocket-message/14789/6 "2019-08-26T14:56:25Z")

</div>

> [@lodv](#):
>
> Can I delete those websockets in the sidebar?

The count shows 0 so yeah, delete.

Also, how many brokers are you running? Typically you have one that both devices publish too and subscribe to. Your talk of different ip address make no sense.

Be sure you only have 1 mqtt config node in total on each pi and that they point to the same broker and have unique client IDs set.

---

<div class="post-metadata">

**Author:** ![lodv](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lodv/32/7963_2.png) [@lodv](https://discourse.nodered.org/u/lodv)\
**Post date:** [26 August 2019 15:06 UTC](https://discourse.nodered.org/t/websocket-message/14789/7 "2019-08-26T15:06:28Z")

</div>

I installed mosquitto on 3 raspberry pi's. I want to control a GPIO on RaspiB in order to activate/disactivate a relays. My node red webapplication runs on Raspi A. So here I use a switch to control the GPIO on raspberry pi B. I thought I had to install node red on both Raspberry Pi's in order to be able to use the MQTT nodes on both Raspberry Pi's. I couldn't imagine another way to do that. Maybe I can do it with code only, but I have not found how to do that. So that my solution.  
Thanks for the reaction.  
Yvonne

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [26 August 2019 15:13 UTC](https://discourse.nodered.org/t/websocket-message/14789/8 "2019-08-26T15:13:34Z")

</div>

The easiest is to have Node-RED installed on all your raspberry Pi’s but you only need Mosquitto installed on one.

Using the MQTT out node publishes a message to a topic on your broker and then the Node-RED on the other Pi’s can subscribe to that topic

---

<div class="post-metadata">

**Author:** ![lodv](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lodv/32/7963_2.png) [@lodv](https://discourse.nodered.org/u/lodv)\
**Post date:** [26 August 2019 15:25 UTC](https://discourse.nodered.org/t/websocket-message/14789/9 "2019-08-26T15:25:58Z")

</div>

I installed the broker like this on al the Raspberry Pi's:  
pi@raspberry:~ sudo apt install -y mosquitto mosquitto-clients pi@raspberry:~ sudo systemctl enable mosquitto.service  
So I actually I don't have to do install it on all Rapberry Pi's?  
Thanks again.

Yvonne

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [26 August 2019 16:04 UTC](https://discourse.nodered.org/t/websocket-message/14789/10 "2019-08-26T16:04:59Z")

</div>

No it would be simpler to install mosquitto on one machine and have all your Node-RED instances publishing and subscribing to that.

There’s a great intro to MQTT here: [https://www.hivemq.com/mqtt-essentials/](https://www.hivemq.com/mqtt-essentials/)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 August 2019 16:20 UTC](https://discourse.nodered.org/t/websocket-message/14789/11 "2019-08-26T16:20:51Z")

</div>

Look at this...

[https://images.app.goo.gl/amMSh5V2GwBSToQ78](https://images.app.goo.gl/amMSh5V2GwBSToQ78)

.. see how there is one broker, like a central hub so to speak. all devices pub to and sub from it.

---

<div class="post-metadata">

**Author:** ![lodv](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lodv/32/7963_2.png) [@lodv](https://discourse.nodered.org/u/lodv)\
**Post date:** [26 August 2019 16:37 UTC](https://discourse.nodered.org/t/websocket-message/14789/12 "2019-08-26T16:37:36Z")

</div>

I'm starting to understand. A final question.  
One raspberry pi is the server and this raspberry pi is also a client of 'itself'. Other Raspberry Pi's need no client installation of MQTT. The moment I write code with a the IP address of the MQTT server or I use the MQTT node in node red on an other raspberry pi or computer it's ok.  
Is that correct?  
I thank you all very much for your answers and time.  
I really mean it that I understand it better now.  
Yvonne

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [26 August 2019 17:58 UTC](https://discourse.nodered.org/t/websocket-message/14789/13 "2019-08-26T17:58:49Z")

</div>

Yes, but for MQTT the “server” is called the broker

---

<div class="post-metadata">

**Author:** ![lodv](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lodv/32/7963_2.png) [@lodv](https://discourse.nodered.org/u/lodv)\
**Post date:** [27 August 2019 12:24 UTC](https://discourse.nodered.org/t/websocket-message/14789/14 "2019-08-27T12:24:28Z")

</div>

In order to work with node red from another raspberry pi it is enough to install a MQTT Python client. Is that correct? I read about Paho MQTT Python client. Is that a good idea? In that case I don't have to install Node red on my raspberry pi zero. Is that right?  
Thnaks.  
Yvonne

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [27 August 2019 12:29 UTC](https://discourse.nodered.org/t/websocket-message/14789/15 "2019-08-27T12:29:02Z")

</div>

That depends on you.  
You could get data via an MQTT broker from anything that’s an send MQTT which could be an arduino with wi-fi or a python app.

But if you don’t already know python why start be trying to master 2 new languages?  
I have a Node-RED running happily on a pi zero.

---

<div class="post-metadata">

**Author:** ![lodv](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lodv/32/7963_2.png) [@lodv](https://discourse.nodered.org/u/lodv)\
**Post date:** [27 August 2019 12:37 UTC](https://discourse.nodered.org/t/websocket-message/14789/16 "2019-08-27T12:37:14Z")

</div>

I'm a bit familiair with Python. I will give it a try.  
Thanks again.
