MQTT messages [message #1756375] |
Thu, 16 March 2017 03:13  |
Eclipse User |
|
|
|
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
|
|
|
|
Re: MQTT messages [message #1764063 is a reply to message #1756393] |
Wed, 24 May 2017 09:49  |
Eclipse User |
|
|
|
You don't need separate connections for publish and subscribe. Each connection can accommodate as many subscribe, publish and unsubscribe requests as you like (in general, apart from any server specifically defined limits or security).
|
|
|
Powered by
FUDForum. Page generated in 0.05151 seconds