OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

mqtt-comment message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [Feature Request] expansion SUBSCRIBE's Retain Handling flag to check broker has no retain message


Hi, I have an idea to expand the "Retain Handling" flag.

# Motivation
I use MQTT retain functionality to know the up to date value of the
topic just after subscribing.
If the broker has a retained message, then the message would be sent.
However, if the broker has no retained message, then no message would be sent.
It is the spec.

The subscriber sometimes needs to distinguish whether the broker has
the retained message or not.
There is no way to do that in the current spec.
One possible workaround is using timeout.
If the retaine publish message is not received until the timeout
duration, then regard to the broker has no retained message.
It's not elegant. The subscriber needs to wait. In addition, even if
the timeout occurs, the retained message may just be delayed by
traffic.

If there is some way to distinguish that broker doesn't have a
retained message, it would be nice.

# Possible expansion for the future spec

The SUBSCRIBE packet has Retain Handling filed.
https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169

According to Figure 3â20â SUBSCRIBE packet Payload format, Retain
Handling uses bit4 and bit5.

The meaning is

https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901104

- If Retain Handling is set to 0 the Server MUST send the retained
messages matching the Topic Filter of the subscription to the Client
[MQTT-3.3.1-9].
- If Retain Handling is set to 1 then if the subscription did not
already exist, the Server MUST send all retained message matching the
Topic Filter of the subscription to the Client, and if the
subscription did exist the Server MUST NOT send the retained messages.
[MQTT-3.3.1-10].
- If Retain Handling is set to 2, the Server MUST NOT send the
retained messages [MQTT-3.3.1-11].

Fortunately, we have one vacant value "3".

So my proposal is adding the clause like as follows:

- If Retain Handling is set to 3, the Server MUST send the retained
messages. If no retained message is stored, then empty payload message
with RETAIN flag 1 MUST be sent.

# Effect

It can remove subscriber's timeout. The subscriber sends SUBSCRIBE
with Retain Handling is 3, and wait SUBACK and PUBLISH.
PUBLISH is received even if the broker doesn't have retained messsage.
So the subscriber can do the next process smoothly.


I would appreciate it if you could consider it.

---
Thanks,
Takatoshi


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]