Reputation: 1003
I am using MQTT with qos 1 which means messages may be sent to client more than once? How can i prevent client from handle same messages twice?
Upvotes: 1
Views: 3479
Reputation: 59866
The only way to know for sure if you have received the message twice is to include an ID in the message payload and maintain a list of processed messages in the client.
The PAHO API includes a isDuplicate() (Javascript version) method on received messages, but this is only an indication that the message may be a duplicate, because the original message may never have arrived.
Upvotes: 4