There is a 30 seconds timeout in the underlying library. I guess that the server doesn't receive the "disconnect" packet when it happens.
If it is problematic for your use case then you can create a new client each time:
B4X:
If mqtt.IsInitialized Then mqtt.Close
Dim mqtt As MqttClient
mqtt.Initialize("mqtt", "ssl://io.adafruit.com:8883", "B4X" & Rnd(0, 999999999))
There is a 30 seconds timeout in the underlying library. I guess that the server doesn't receive the "disconnect" packet when it happens.
If it is problematic for your use case then you can create a new client each time:
B4X:
If mqtt.IsInitialized Then mqtt.Close
Dim mqtt As MqttClient
mqtt.Initialize("mqtt", "ssl://io.adafruit.com:8883", "B4X" & Rnd(0, 999999999))