I'm using ESP8266-7 as the only micocontroller in my project and I have a tiny problem it. there is some times that the internet line is broken and my ESP tries to reconnect to the broker. while this happens, the program freezes until the internet get back online and ESP reconnects to the broker.
mqtt_client.connect(device_ID.c_str(), mqtt_user.c_str(), mqtt_pass.c_str())
how can I try to connect to the broker, without using this code or is there any other solution for me?
can ESP connects to the broker in the background while my program is still running?