November 27, 2024, 01:01:39 AM

Cannot Publish to MQTT Broker

Started by georsyme, May 03, 2023, 12:17:55 PM

Previous topic - Next topic

georsyme

I am trying to establish a connection with an MQTT Broker(cloud mqtt) and send messages to a topic. I am using wifi Client(<WiFi.h>) and pubsubClient(<PubSubClient.h>). The code i am using has been tested in arduino uno and it works. Although with ESP32-EVB-IND cannot publish messages to the topic. My credentials and hardware connections are corect and tested lots of times. I am using standar mqtt protocol(not ssl). After client.connect() i print the client state and its MQTT_CONNECTED(0). I can see the connection established in my borker. But when i am trying to publish a message the state changes to MQTT_CONNECTION_LOST(-3). Any ideas?