Open dsilletti opened 2 years ago
P.S. I understand that keepalive is responsible for disconnecting in this case, so client.connected() will return true up to ~2*keepalive time, but the publish and mqtt loop functions need a timeout to avoid blocking the entire core for so long (> 30s in my case)
So what's the solution?
@GDev-4664 The workaround I applied is to create another task to periodically check the MQTT connection status and handle reconnection, this way the main task will not be blocked.
@dsilletti could you please share your solution?
After a successful connection to the MQTT broker on the internet, the connected() function returns true even if the internet is no longer available but the WiFi is connected, causing the MQTT publish and loop functions to hang and reset the board due to the watchdog (configured to 30 seconds)
I also have setSocketTimeout to 1 and setKeepAlive to 15 or 5 seconds but it doesn't help.
pubsubclient v2.8 ESP32 Arduino core 2.0.3