LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MQTT: Error 66 when reading subscribed topics

Hi, for the past month I have been working on two MQTT clients that will communicate with each other over a CloudMQTT broker. The clients use the DAQIO LabVIEW MQTT library (found here https://github.com/DAQIO/LVMQTT). The basic operation is that one client (LaptopClient) will publish commands to the other client (USBClient), which will read the command, perform an action, and publish a message back to the origin.

 

The problem is that when USBClient is unable to read the command. When USBClient is initialised and is waiting for LaptopClient to send a command, and LaptopClient sends a command, the "read subscribed topics" function of USBClient will present error 66, saying that the connection was closed.

 

What I've tried:

 

1. Using a local broker, instead of CloudMQTT

This resulted in no error, but I cannot use a local broker for the final product because I will not be able to connect from another computer over a wireless network.

 

2. Replacing LaptopClient's publish with mosquitto_pub (isolating USBClient)

This resulted in no error, USBClient was able to read the command and publish an acknowledgment.

 

3. Replacing USBClient's subscribe with mosquitto_sub (isolating LaptopClient)

This resulted in no error, LaptopClient was able to publish the command successfully.

 

4. Connecting to my phone's mobile hotspot

I tried this because I thought there might have been an issue with the network. It resulted in error code 1, which states that an input parameter was invalid. However, the only input parameter was the connection ID.

 

5. Replacing LaptopClient with default test client provided by DAQIO LabVIEW MQTT Library

I tried this to eliminate issues with the library. It resulted in no error.

 

It does not make sense to me, why does it work over a local broker but not online? Why does it work when either of the clients are replaced? As you can see, the error occurs after reading the subscribed topics.

 

 

Capture.PNG

Download All
0 Kudos
Message 1 of 4
(3,355 Views)

Hi john134,

 

I have a similar problem. Do you have solved yours?

 

 

0 Kudos
Message 2 of 4
(1,896 Views)

I recommend to switch over to the API mentioned here:

https://forums.ni.com/t5/Community-Documents/MQTT-Driver-for-LabVIEW/ta-p/3561289

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 3 of 4
(1,881 Views)

Thanks for this link.

 

I found the problem: the "keep alive"-input was set to zero by default. I set it to 60s and it works.

 

 

Message 4 of 4
(1,870 Views)