The use of the ESP8266 in the world of IoT

User avatar
By Masoud Navidi
#87682 Hi everyone.

I am trying to get connected to the broker via esp8266-07. Most of the times I get connected and I don't have any problems at all (it sometimes disconnects from broker but I have a reconnect() function in my code and esp connects to the broker right away, so I don't have problems there ;) ).

but there are sometimes when I plug in the device, and start the esp, the code runs up to this part,
Code: Select allmqtt_client.connect(device_ID, mqtt_user, mqtt_pass);

it waits a little (about 5 seconds), and then it passes this part of the code and doesn't connect to the broker , no matter how many times I re-do this. the only solution to this problem is turning of the esp and turn it back on after about 10 seconds.

How can I deal with this problem if I don't want to restart my esp?