Search code examples
mqttesp8266mosquittonodemcu

Can't connect multiple nodemcu to same broker


I am currently working on a project in which I use ESP8266 wifi modules with mqtt. I use a mosquitto broker installed on my computer.

I am trying to make more than one esp8266 modules subscribe to a certain topic on the broker. I am using two modules as a demo.

The problem is that whenever I connect one of the modules, the other one disconnects from broker. When I re-connect it the first module (that has just been connected) goes offline.

Any help?


Solution

  • You need to use unique client ids for each module. The broker will kick the first client off when the second connects with the same client id