If a client is disconnecting, is it necessary to unsubscribe beforehand?
I originally thought it was, but then if a client disconnects unexpectedly, you cannot unsubscribe ..
therefore, unsubscribing is pointless unless you are still connected and no longer want to receive messages ..
Is this a correct assumption?
If you have connected with the clean session
flag set to 1 then when you disconnect the broker will remove all of your subscriptions and other information.
If clean session
was set to 0 when you connected, then your subscriptions are saved at the broker until you unsubscribe (or reconnect with clean session
set to 1 at a later point)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With