09/18/2023
Hello guys,
I am following the basic steps in order to publish and subscribe in a Raspberry Pi and Windows environment, but it seems to have a problem with the subscriber, as shown in the code below. I checked the connections and the code itself and couldn't identify what is messing up my tests. I even checked the messages to the broker using the mqtt-spy and it seems to be working as well.
Do you have a lead on what is causing it?
Publisher:
pi@raspberrypi:~/MqttAgent $ dotnet MqttAgent.dll publish --broker mqtt://192.168.137.1:1883 --id device:one --topic starterkit
Starting OPC UA Server.
Connecting OPC UA Server.
Loading Configuration (PublisherId=device:one).
opc.tcp://raspberrypi:48040/
Starting Publisher (BrokerUrl=mqtt://192.168.137.1:1883/ V311 TopicPrefix=starterkit).Select Option:
[X] to stop the program.
Subscriber:
C:\git\StarterKit\UA-IIoT-StarterKit\build\bin\Debug\MqttAgent
et6.0> dotnet MqttAgent.dll subscribe --broker mqtt://127.0.0.1:1883 --topic starterkit
Loading Configuration (PublisherId=).
Starting Subscriber (BrokerUrl=mqtt://127.0.0.1:1883/ V311 TopicPrefix=starterkit).
CONNECT: SuccessÂ
Select Option:
[1] to subscribe to 'device:one'.
[M] to print the menu.
[X] to stop the program.SUBSCRIBE: device:one.
[NullReferenceException] Object reference not set to an instance of an object.
1 Guest(s)