Other MQTT Best Practice

CR95

Active Member
Licensed User
After publishing an IoT MQTT message to a specific topic, my "sender program" receives this message as member from this specific topic. I understand that this is the "normal" process of the broker.

My issue is how to separate the incoming messages coming either from me (as said before) or from another user (which I have to process).

I found a solution proposed in a Chat exemple : each user add his specific ID at the end of the Topic name. Then, it is possible when receiving a message to test the "extension" of the topic name of the sender and to be able to diffrentiate the origin.

Is that the best practice ?

If yes, do I have to put a slash (/) between the Topic Name and the extension (it works fine without)

And finally, what is the purpose of the ClientID declared in the "Initialize" MQTT starting process ?

Thanks for your help
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
And finally, what is the purpose of the ClientID declared in the "Initialize" MQTT starting process ?
This id identifies each client. If two clients will use the same id then they won't receive messages properly.

Is that the best practice ?
I don't know whether it is the "best" solution but it is not a bad one.
 
Upvote 0
Top