Closed MarioRossi37 closed 1 year ago
Please ask this kind of question in one of the resources shown in the readme. You need to consider what could lead to a failure and whether you want to retry (if the broker returns an error then it's likely you will get the same error on repeat attempts). The most likely cause of failure is probably a network issue, but if that happens the client will reconnect, so your current code will retry...
Closing this as it's something best discussed elsewhere (and not really an issue specific to this particular client).
I have to find a way to re-subscribe to topics after connection lost. Currently I have something like this:
and then on the
onConnect
handler something similar toThat way if the device loses connection and then resumes it, entering the
onConnect
should re-subscribe to the topics.However, what happens if the subscription fails? I would like to automatically retry to subscribe (and not just log the error). What is the correct way to achieve this?