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?
https://github.com/OLIMEX/ESP32-POE/tree/master/SOFTWARE/ARDUINO/ESP32_PoE_MQTT-Azure_ETH_WiFi
https://github.com/OLIMEX/ESP32-POE/issues/6