Unable to connect broker:mqtt and node-red

I have installed mosquitto broker and Node red in my PC.
I'm able to subscribe and publish messages.
But in Node red i'm unable to connect to mqtt.

17 May 10:46:25 - [info] Starting flows
17 May 10:46:25 - [info] Started flows
17 May 10:46:25 - [info] [mqtt-broker:cb3902d2d36e9b73] Connection failed to broker: mqtt://localhost:1883

You might want to install MQTT Explorer if running Windows. You can then test a different connection to the broker. If that doesn't work, I would check the Mosquitto configuration and if that still doesn't turn up the issue, increase Mosquitto's logging level to see what the problem is.

Is NR running on the same device as mosquito? As is, you are trying to connect to a broker on the same device. If it is on another device, you need to specify the IP of the device running mosquito.

Yes Node Red is running on the same device.
I'm configuring Mqtt node server as localhost:1883

What is doing this subscribe and publish?
What device is it on?
Pease show it’s configuration
Please shot the MQTT configuration in node-red

Able to resolve it after running NodeRed in host networking mode.

So you are using Docker or a VM or some kind of container to run node-red?

This sort of information is really important when asking for help.

1 Like

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