Dim client As JavaObject = mqtt
client = client.GetField("client")
Dim event As Object = client.CreateEventFromUI("org.eclipse.paho.client.mqttv3.MqttCallback", "callback", Null)
client.RunMethod("setCallback", Array(event))
Sub Callback_Event (MethodName As String, Args() As Object) As Object
Log(MethodName)
Select MethodName
Case "messageArrived"
Dim topic As String = Args(0)
Dim MqttMessage As JavaObject = Args(1)
Case "connectionLost"
Log("Connection lost")
Case "deliveryComplete"
End Select
Return Null
End Sub