|Re: [paho-dev] When to invoke MQTTClient_disconnect() and MQTTClient_destroy() in long running application ?|
no you do not need to call destroy(). That is only to clean up resources when you don't need a client object at all. If the client object is the last or only one, then destroy() also cleans up resources for the entire library, which has caused some issues under some circumstances. It's a plan of mine to separate out this library cleanup code into a separate, explicitly called function to avoid those issues entirely but I have not done that yet.
Definitely don't call destroy() unless you really have finished
with the client object. There is no need to recreate during a
long running process, just re-connect.
On 22/05/2019 07:51, Durgesh Tanuku wrote:
-- Ian Craggs icraggs@xxxxxxxxxx IBM United Kingdom Eclipse Paho Project Lead & Mosquitto Committer
Back to the top