I want to reconnect an MQTT client to a server on failure.
I am using uqmtt.robust
for the reconnection: it is working for some failures but not handling internet disconnections. I am thinking about doing like:
while True:
if c.isConnected():# how to check this?
c.wait_msg()
else:
c=MQTTClient(params)
c.connect() #reconnect trial
I tried to solve by reading PINGRESP but pings are in interval so I couldn't find whether the connection is live or not.