Adafruit_MQTT_Library
Adafruit_MQTT_Library copied to clipboard
Allow new subscriptions after connect
Hi,
Looking at the source of Adafruit_MQTT::connect()
, I see that it's the only place where the actual subscription is being performed.
I would like to be able to subscribe to topics after connection too, like unsubscribe.
I'm using this library with an Adafruit Fona.
I just wanted to thank the poster for taking the time to ask this. I missed the need as well and spent a few hours debugging my code. It's this post that pointed me in the right direction.
I also wanted to thank the poster. I ran into this issue as well and also wasted a few hours debugging my code.
So the logic for subscribing after mqtt.connect() is to disconnect from the mqtt server by calling mqtt.disconnect(), subscribe to the topic, and then reconnect to the mqtt server?