DUP flag in MQTT 3.1.1 specification

881 views
Skip to first unread message

Paolo Patierno

unread,
May 3, 2014, 9:13:36 AM5/3/14
to mq...@googlegroups.com
Hello,
I have a doubt about DUP flag in MQTT 3.1.1 specification for some messages.
Let's consider SUBSCRIBE and UNSUBSCRIBE message.
They have bits 3,2,1 and 0 in the fixed header equals to 0,0,1,0.
In general the above bits mean : DUP, QOS Level (2 bit) and RETAIN.
If SUBSCRIBE and UNSUBSCRIBE have bit 3 (DUP) fixed to 0.
Now, If client send SUBSCRIBE/UNSUBSCRIBE message for the first time but it doesn't receive SUBACK/UNSUBACK, it has to resend message.
Doesn't it set bit 3 (DUP) equals to 1 ? Must the bit 3 be 0 even if it is a resend of a message (duplicate) ?

Paolo.

Paolo Patierno

unread,
May 3, 2014, 9:16:13 AM5/3/14
to mq...@googlegroups.com
The same with PUBREL message that is resend if after closed phase one (PUBLISH, PUBREC), the client doesn't receive PUBCOMP after the first PUBREL so it resends the PUBREL message (duplicate flag ? 1 or fixed 0....bit 3 in the fixed header ?)

Nicholas O'Leary

unread,
May 3, 2014, 3:34:00 PM5/3/14
to mq...@googlegroups.com
The dup flag was never intended for use with sub/unsub messages - it was only meant for use with the publish packet. This is one of the things the 3.1 spec was not very clear on, so has been made much clearer in 3.1.1.

There is nothing useful a server can do with the information provided by the dup flag in a subscribe packet; it has to process the subscribe on the assumption it has not already received it.

Likewise, a server would behave no differently on receiving a pubrel with the dup flag sent.

Nick





--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+uns...@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at http://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.

张斌

unread,
May 20, 2014, 12:14:10 PM5/20/14
to mq...@googlegroups.com
 But according to chapter 4.2 of MQTT Spec V3.1, it says:

In the case of MQTT messages that expect a response (QoS >0 PUBLISH, PUBREL, SUBSCRIBE, UNSUBSCRIBE), if the
response is not received within a certain time period, the sender may retry delivery. The sender should set the DUP flag on the message.

So it means DUP flag is used on SUBSCRIBE and UNSUBSCRIBE ? V3.1.1 is not compatible with V3.1?


BR,
Bin
Reply all
Reply to author
Forward
0 new messages