Websocket message


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.


1 Like

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?

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?

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.


Mosquitto is the broker

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.

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.

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

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.


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/

Look at this...


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

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.

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

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?

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.

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