MQTT messages [message #1756375] |
Thu, 16 March 2017 07:13 |
Mike Dsouza Messages: 4 Registered: January 2017 |
Junior Member |
|
|
Hello All,
I am using Paho C client for embedded for MQTT implementations. I was able to implement single pub/sub message with it. Now for multiple pub/sub messages I am facing issues for getting CONNACK. What could be going wrong?
Following is my implementation,
Publish -
1. Use MQTTSerialize_connect by passing data like client id, version, user name, password, clean session etc
2. For pub, use MQTTSerialize_publish call with topic info and send data over socket
Subscribe -
3. For sub, repeat step #1 and send data over socket
4. Wait for CONNACK using MQTTPacket_read call
5. If CONNACK is received, use MQTTSerialize_subscribe with topic name and send data over socket
6. Wait for SUBACK using MQTTPacket_read call
7. if SUBACK received, wait for PUBLISH using MQTTPacket_read call
Above works for first set of messages - publish and then subscribe. After receiving the message against subscribed topic, I subscribe for another topic using same steps as above but it fails to receive the 'CONNACK'
What is going wrong? Am I following the right steps for pub/sub? Any step(s) repeated unnecessarily?
Appreciate any help. Thanks in advance.
Mike
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02627 seconds