I've tested the following code and it does work, the module does not freeze in runtime mode. I didn't try to debug it.
Sometimes my MQTT server doesn't get the external publish, don't know why yet. Maybe a mosquitto bug, dunno.
Class MQTTSubscribeExample
Const DeviceId As String = "mc-001"
Const SubscribeTopicLED1 As String = "mcThings/ioT/" + DeviceId + "/led1"
Const SubscribeTopicLED2 As String = "mcThings/ioT/" + DeviceId + "/led2"
Shared Event Boot()
Lplan.SetLowPowerMode(1) ' CAUTION: do not use 1 second interval in production
Lplan.Subscribe(SubscribeTopicLED1)
Lplan.Subscribe(SubscribeTopicLED2)
End Event
Shared Event SubscriptionDelivery()
Dim msg As Message = Lplan.GetDelivery()
If msg.Topic= SubscribeTopicLED1 Then
Dim payload As ListOfByte = msg.PayLoad
If payload(0) = 0x31 Then
LedGreen = True
Else
LedGreen = False
End If
ElseIf msg.Topic= SubscribeTopicLED2 Then
Dim payload As ListOfByte = msg.PayLoad
If payload(0) = 0x31 Then
LedRed = True
Else
LedRed = False
End If
End If
End Event
End Class