Good morning everybody,
I am trying to understand what is going on here. I have a B4J application with an mqtt broker created with moquette project broker as seen in the relevant thread in the forum and an other application which is the mqtt client and tries to connect to the broker with credentials defined in MqttConnectOptions (
I am trying to understand what is going on here. I have a B4J application with an mqtt broker created with moquette project broker as seen in the relevant thread in the forum and an other application which is the mqtt client and tries to connect to the broker with credentials defined in MqttConnectOptions (
Private mqttconnopt As MqttConnectOptions
). When the broker runs it connects without any problem. When I try to stop the execution of the broker and try to connect with the following code to catch the case that the broker is unaccessible it never gets to the catch clause and instead probably uses an internal try-catch. Is there a way to make it work the desired way?
B4X:
Public Sub Connect
Try
mqttclient.Connect2(mqttconnopt)
Catch
#if b4a or b4j
If SubExists(oParent, sEvent & "_NotConnected") Then
#End If
#if b4i
If SubExists(oParent, sEvent & "_NotConnected", 0) Then
#End If
CallSub(oParent, sEvent & "_NotConnected")
End If
Log(LastException)
End Try
End Sub