esp-idf-svc
esp-idf-svc copied to clipboard
How should MQTT resubscriptions be made for reconnections?
When the MQTT client has to reconnect and resubscribe on a disconnection, how should this be achieved? The client instance is required to subscribe again, but this is not available (as far as I'm aware of) inside the callback provided to the EspMqttClient.new function. Is there a way to achieve this?
The client reconnects automatically. How I re-subscribe is that I'm listening for Connected events and re-subscribing the client after that.
And yes, you have to subscribe the client from outside the callback.