QOS 1 and RETAIN

62 views
Skip to first unread message

Behrad Zari

unread,
Oct 12, 2016, 1:51:24 AM10/12/16
to MQTT
Consider following scenario:

1) Client C1 is subscribing to T1 with qos=1, clean=false
2) C1 disconnects
3) Client C2 publishes a retained message (M1) on T1
4) C1 connects (without sending a subscribe)
5) Should C1 receive M1?

My first question is should a standard broker forward M1 to C1 after CONNCET?

Going further I'm also eager to know whats the relation of QOS and RETAIN?
Would the answer change if M1's QOS was 0 or 1?

vardhar...@smackcoders.com

unread,
Dec 21, 2016, 3:22:42 AM12/21/16
to MQTT
Thanks, for this Interesting question
Answer for your First question. Yeah the MQTT Broker send M1 to C1. Not only the M1, Broker send all the pending messages received to the subscribed topic after the client c1 went offline because C1 subscribed to T1 with QOS 1. Any client (clean=false) subscribed to the topic with QOS 1 or 2 (optionally 0) then the broker will send all the messages which was received in the topic during the client's offline period.

Retained message is single message stored to every topic which was updated by the last arrived one with retained bit. 
M1's QOS was 0 or 1 that's not a matter, If it was a retained one, then the message was stored by the broker and send to the future subscribers.

Behrad Zari

unread,
Jul 14, 2017, 4:30:48 AM7/14/17
to MQTT
My question is now how broker should handle a retained qos=1 message?

Should it both store as retained and store the same message in client's offline queue? That way client will receive twice the same message!

Another question: should broker handle deduplication of redelivery of a retained message to a client on CONNECT?
Reply all
Reply to author
Forward
0 new messages