How to stop the reconnection of MQTTClient?
muqtheear opened this issue · 5 comments
Hi,
I have written a C++ application using Paho MQTT C++ sdk which is trying to connect MQTT server through proxy.
Initially I configured wrong proxy and tried to connect with the set_automatic_reconnect to true.
Any how connection to MQTT server failed, and it is trying to reconnect internally.
Now I would like to stop the reconnection
I tried setting set_automatic_reconnect to false and tried connect/reconnect, but that seems like not working.
Can you please share a sample on stopping the reconnection.
Thanks & Regards,
Muqtheear.S
Hi,
Is there any update on my above query?
Thanks & Regards,
Muqtheear.S
Hi Crags,
Is there any update on this?
Thanks & Regards,
Muqtheear.S
For cpp there is an example here:
https://github.com/eclipse/paho.mqtt.cpp/blob/master/src/samples/async_subscribe.cpp#L150
with the condition
https://github.com/eclipse/paho.mqtt.cpp/blob/master/src/samples/async_subscribe.cpp#L121
(I've only seen the example and can't say any more. )
Call MQTTAsync_disconnect. You'll get a -3 (MQTTASYNC_DISCONNECTED) return code, but the auto reconnect should stop.
Question answered.