You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have PubSubClient running fine on an ESP32 which connects without any problems to an MQTT broker in my local network.
For my project, I now want to include an MQTT broker in my code on the same ESP32 that PubSubClient is running on, so that users have the choice of using a dedicated MQTT broker or - if my project is the only one they need MQTT for - use a small MQTT broker on the same ESP32. For that I have included PicoMQTT. I can connect to the PicoMQTT broker on that same ESP32 that PubSubClient is running on from MQTT Explorer and publishing and subscribing the topics from outside the ESP32 works fine. PubSubClient is also still running fine when subscribing and publishing to an external MQTT broker, but what is not working is for PubSubClient to connect to the PicoMQTT broker.
I have used the actual local IP, as well as 127.0.0.1 as well as "localhost" to tell PubSubClient that it should connect to the broker on the same host, but the connection fails all the time. state() returns -2 which means that the connection has failed.
Does anyone have an idea why this is the case? I don't want to switch to PicoMQTT for the client functions because it only runs on ESPs, not on the Arduino Due which is also used by a number of my users. Adding an optional feature such as the broker would be fine to offer for just the ESP users.
Any help is highly appreciated!
The text was updated successfully, but these errors were encountered:
I have PubSubClient running fine on an ESP32 which connects without any problems to an MQTT broker in my local network.
For my project, I now want to include an MQTT broker in my code on the same ESP32 that PubSubClient is running on, so that users have the choice of using a dedicated MQTT broker or - if my project is the only one they need MQTT for - use a small MQTT broker on the same ESP32. For that I have included PicoMQTT. I can connect to the PicoMQTT broker on that same ESP32 that PubSubClient is running on from MQTT Explorer and publishing and subscribing the topics from outside the ESP32 works fine. PubSubClient is also still running fine when subscribing and publishing to an external MQTT broker, but what is not working is for PubSubClient to connect to the PicoMQTT broker.
I have used the actual local IP, as well as 127.0.0.1 as well as "localhost" to tell PubSubClient that it should connect to the broker on the same host, but the connection fails all the time.
state()
returns-2
which means that the connection has failed.Does anyone have an idea why this is the case? I don't want to switch to PicoMQTT for the client functions because it only runs on ESPs, not on the Arduino Due which is also used by a number of my users. Adding an optional feature such as the broker would be fine to offer for just the ESP users.
Any help is highly appreciated!
The text was updated successfully, but these errors were encountered: