oasis-tcs / mqtt

OASIS MQTT TC: Technical refinements of features
Other
4 stars 2 forks source link

MQTT-614 Semantics and Treatment of Publish without Session #11

Closed icraggs closed 3 months ago

icraggs commented 5 months ago

https://issues.oasis-open.org/browse/MQTT-614

Under what circumstances is it ok to drop a PUBLISH WITHOUT SESSION?

How is it different to QoS 0?

icraggs commented 5 months ago

Ian Craggs:

The MQTT 5.0 spec says this about QoS 0:

The message is delivered according to the capabilities of the underlying network. No response is sent by the receiver and no retry is performed by the sender. The message arrives at the receiver either once or not at all.

PUBLISH WITHOUT SESSION has similar semantics but is not associated with a session and is sent to a network address (which can be multicast or broadcast). That is the entire normative behaviour on the sending side IMO.

On the broker side it says this:

When a Server takes ownership of an incoming Application Message it MUST add it to the Session State for those Clients that have matching Subscriptions

This is in the message receipt section 4.5. I think we need to have a similar section, but expanded to take account of transparent gateways which devolve responsibility to an associated MQTT connection.

Something like, on message receipt the MQTT-SN server MUST either:

  1. add it to the MQTT-SN session state for those clients with matching subscriptions, or
  2. forward it to an associated MQTT session

But in the same way that an MQTT broker or MQTT-SN gateway can deny a connecting client for various reasons, as there is no connect involved in a PUBLISH WITHOUT SESSION, it can deny a PUBLISH WITHOUT SESSION if it does not reach the gateway's criteria - if there is no protection encapsulation for instance.

icraggs commented 5 months ago

Davide:

It should not be considered different as QoS0

Actually I think PUBLISH WITHOUT SESSION is QoS0 when a session is not defined but the gateway is still able to associate this packet to an MQTT 5 session

icraggs commented 5 months ago

The difference is in the acceptance of the message in the first place. QoS 0 is sent on a virtual connection so has some origin identification. PUBWOS doesn't - although the protection encapsulation can provide some of that. Whether the message is accepted is a solution-level decision - which broadcast/multicast addresses to listen on, which topics to be interested in, etc.

Once the message is accepted, PUBWOS messages are treated the same as QoS 0.

icraggs commented 3 months ago

Added to section 4.3.1. Also tracked in Jira again.

sthagen commented 2 months ago

At https://issues.oasis-open.org/browse/MQTT-614