Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep Alive bytes swapped #1

Open
victorclaessen opened this issue Feb 12, 2018 · 6 comments
Open

Keep Alive bytes swapped #1

victorclaessen opened this issue Feb 12, 2018 · 6 comments

Comments

@victorclaessen
Copy link

Hi, thanks for making this library. It's really nice!

However, I think I found a bug:

The MQTT spec (3.1.2.10) specifies that the Keep Alive bytes are in order MSB, LSB. But in mqttCmdConnect\mqttCmdBuildVarHdr.vi the high and low bytes of the keepalive value are swapped before building the CONNECT header. I suspect that that swap is unnecessary, and results in the wrong value being used by the broker for the keep alive time. I verified that with Wireshark by checking the transmitted TCP packet of the CONNECT command.

Best regards,

Victor

@victorclaessen
Copy link
Author

A related question: In mqttTCPIPserver.vi, in the "Keep Alive Loop" at the bottom, there is a 'wait on notification' function with a subsequent case structure. The selector for the case structure is now connected to the 'timed out?' terminal of the 'wait on notification' function. Wouldn't it be more logical to connect the case selector to the 'notification' terminal instead? Or am I misinterpreting your intention?

@steve-bamlabs-com
Copy link

Victor, What have you figured out for both of these issues? I'm using this MQTT model also.. I'm having problems with time outs. Any help would be much appreciated.

Thanks

Steve

@victorclaessen
Copy link
Author

Together with a colleague I made some modifications to this library, I'll see if I can upload them from my work computer tomorrow. It's in LabVIEW version 2017 now.

@steve-bamlabs-com
Copy link

steve-bamlabs-com commented May 1, 2018 via email

@victorclaessen
Copy link
Author

I'm sorry I just realised I totally forgot about this. The most important thing we added was to make sure to flush the outgoing packet queue before reconnecting, otherwise upon reconnect some data/publish packets get sent out before the packets that establish the connection with the broker (sort of login packets), which will confuse the broker to the point that it just disconnects.

https://github.com/victorclaessen/mqtt-LabVIEW

I also made an example program (kind of targeted for internal use with out broker) where I tried to put everything in as few subVI/structures as I could to keep the main program small. (requires the above library).

https://github.com/victorclaessen/example_mqtt_LabVIEW_program

Hope that helps.

Victor

@steve-bamlabs-com
Copy link

steve-bamlabs-com commented May 4, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants