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: Will delay and online conflict client id


Hi,

I'm implementing a MQTT broker.
I have a question about Will sending timing.

The scenario is as follows:

1. A client CONNECT to the broker.
    Client Identifier: cid1 , Session Expiry Interval: 0 (or absent) ,
Will Delay Interval: 10 ( > 0).
2. While the client is connected, the new client CONNECT to the broker
    Client Identifier: cid1, Clean Start: false

In this case, should the the will of the first (step 1) connection be sent ?
I think it should be sent.

The reasons are as follows:

----
> 3.1.2.11.2 Session Expiry Interval
> If the Session Expiry Interval is absent the value 0 is used. If it is set to 0, or is absent, the Session ends when the Network Connection is closed.

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

> 3.1.3.1 Client Identifier (ClientID)
> The Client Identifier (ClientID) identifies the Client to the Server. Each Client connecting to the Server has a unique ClientID.

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

The spec doesn't describe what happens if the same Client Identifier
as the existing online connection is used by the new connection.
But closing the existing network connection and then connecting the
new connection is an ordinary implementation.
e.g. mosquitto does that.

----

> 3.1.3.2.2 Will Delay Interval
> The Server delays publishing the Clientâs Will Message until the Will Delay Interval has passed or the Session ends, whichever happens first.
https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901062

----

The important point is the first connection's Session Expiry Interval:
0 (or absent) .
Even if the first connection's Will Delay Interval: 10 ( > 0) and the
second connection's Clean Start: false, the session of the first
connection is ended.
So the first connection Session end comes first. So the will of the
first connection should be sent.

I had been confused by the following comment, at first:

> 3.1.3.2.2 Will Delay Interval
> Non-normative comment
> If a Network Connection uses a Client Identifier of an existing Network Connection to the Server, the Will Message for the exiting connection is sent unless the new connection specifies Clean Start of 0 and the Will Delay is greater than zero. If the Will Delay is 0 the Will Message is sent at the close of the existing Network Connection, and if Clean Start is 1 the Will Message is sent because the Session ends.

But the comment describes nothing about Session Expiry Interval.
I think that if the Session Expiry Interval is greater than 0 as
follows, then the will shouldn't be sent.

1. A client CONNECT to the broker.
    Client Identifier: cid1 , Session Expiry Interval: 10 (>0) , Will
Delay Interval: 10 ( > 0).
2. While the client is connected, the new client CONNECT to the broker
    Client Identifier: cid1, Clean Start: false

However, my first case (Session Expiry Interval: 0 (or absent)), the
will should be sent.

Am I understanding correctly ?

---
Thanks,
Takatoshi


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