Page 1 of 1

ESP-MQTT does not disconnect when router loses internet

Posted: Tue Oct 23, 2018 3:30 am
by jollytopper
If the esp module loses connection to the router, then the disconnect is called.

If the router loses connection to the rest of the internet by removing the ethernet cord, then neither the wifi event handler nor the mqtt even handler indicates the connection has been lost.

Re: ESP-MQTT does not disconnect when router loses internet

Posted: Tue Oct 23, 2018 12:01 pm
by vonnieda
Make sure you have keepalive turned on. This will result in a ping being sent periodically and if the ping is not received the client will disconnect.

Re: ESP-MQTT does not disconnect when router loses internet

Posted: Tue Oct 23, 2018 5:27 pm
by fly135
Best to put timeouts on your sockets in case the internet connection is down or packets lost. Or.. ^ what he said. :)

John A