How dose MQTT process the duplicated message when retransmitted.

1,443 views
Skip to first unread message

Shafreeck Sea

unread,
Apr 28, 2016, 4:27:19 AM4/28/16
to MQTT
I noticed that when I retransmit a message and set dup flag, the phao mqtt client still can receive the message whenever the previous message is lost. I expect that the duplicated message should be dropped because the client KNOW that the message has been acknowledged by the packet identifier. Am I right ?

Filipe Nicoli

unread,
May 12, 2016, 3:59:51 PM5/12/16
to MQTT
Taken from here (about the DUP flag on Paho's client library):

[...] When true, the client application should take appropriate action to deal with the duplicate message.

As it seems, dropping a DUPlicated message is up to the application, not the protocol or the underlying client library.


This HiveMQ post states that:
The duplicate (DUP) flag [...] won’t be processed by broker or client in the case of QoS 1. The receiver will send a PUBACK regardless of the DUP flag.

So under QoS 1 (at least once) you can have multiple duplicates of the message bouncing on the network and both library and broker will ACK each one of them.
If you are having trouble with duplicated messages, you can try QoS 2, which employs hard policies against duplicates. There's a tradeof on network usage, since QoS 2 uses some more messages to ensure only one copy of the message is delivered.

Hope it helps.

Shafreeck Sea

unread,
May 30, 2016, 1:10:22 AM5/30/16
to MQTT
Thanks, it really helps a lot !
Reply all
Reply to author
Forward
0 new messages