Disconnect
This method will disconnect the client from the broker, and return a true or false value if the disconnect succeeds or fails. The purpose of this method is to provide the developer a way to handle a disconnect (i.e. the user exits the app). If it was disconnected, this returns a true value; if it remains connected, this returns a false value. Note that client connections are dropped automatically if the MQTT broker does not sense the client connection is alive.
Group: MQTT Object
Syntax: oMQTT.Disconnect as Boolean
Example:
Dim WithEvents moClient As New MQTT
Private Sub Form_Load()
On Error Resume Next
App.Balloon("Connecting...", -1)
If Not moClient.Connect("tcp://localhost:1883", "RFgen_Publisher_Client_001", 4000)
Then
moClient.Disconnect
App.ExitForm
Exit Sub
End If
App.Balloon("", 0)
End Sub
Versions Supported: RFgen 5.1.1.35 and 5.2.3 and newer.