B4J Question mqtt.close takes 30 seconds to close connection

Solution
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))

Erel

B4X founder
Staff member
Licensed User
Longtime User
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))
 
Upvote 0
Solution
Top