Adafruit_MQTT_Library icon indicating copy to clipboard operation
Adafruit_MQTT_Library copied to clipboard

Allow new subscriptions after connect

Open andrei-ivanov opened this issue 7 years ago • 3 comments

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.

andrei-ivanov avatar Mar 18 '17 20:03 andrei-ivanov

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.

Thuetar avatar Aug 23 '17 21:08 Thuetar

I also wanted to thank the poster. I ran into this issue as well and also wasted a few hours debugging my code.

bbustin avatar Feb 16 '18 18:02 bbustin

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?

swrocks253 avatar Sep 28 '23 14:09 swrocks253