Uploaded image for project: 'OASIS Message Queuing Telemetry Transport (MQTT) TC'
  1. OASIS Message Queuing Telemetry Transport (MQTT) TC
  2. MQTT-543

Allow long topic names for publish of all QoS

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Applied
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: MQTT-SN-1.2
    • Fix Version/s: None
    • Component/s: MQTT-SN
    • Labels:
      None
    • Proposal:
      Hide

      Section 5.3.4 Flags

      • TopidIdType: indicates whether the field TopicId included in this packet contains:
        • "0b00" - a registered topic id
        • "0b01" - a pre-registered topic id
        • "0b10" - a short, 2-byte, topic name
        • "0b11" - a long topic name

      Section 5.4.12 PUBLISH

      Add a publish packet version for a long topic name (topicIdType "0b11")

      Length MsgType Flags TopicLength MsgId TopicName Data
      (octet 0) (1) (2) (3-4) tl (5-6) (7 - 7+tl) (8+tl - n)

      Table 16.1: PUBLISH Packet

      TopicLength: the length of the long topic name if the topicIdType is "0b11".

      TopicName: the long topic name if the topicIdType is "0b11". 

      If a connection has not been established, the only QoS that can be used is -1.  In these circumstances, a registered topic id cannot be used as there is no means for registration.  Pre–registered topic ids, short and long topic names can be used with QoS -1.

       

       

      Show
      Section 5.3.4 Flags TopidIdType: indicates whether the field TopicId included in this packet contains: "0b00" - a registered topic id "0b01" - a pre-registered topic id "0b10" - a short, 2-byte, topic name "0b11" - a long topic name Section 5.4.12 PUBLISH Add a publish packet version for a long topic name (topicIdType "0b11") Length MsgType Flags TopicLength MsgId TopicName Data (octet 0) (1) (2) (3-4) tl (5-6) (7 - 7+tl) (8+tl - n) Table 16.1: PUBLISH Packet TopicLength: the length of the long topic name if the topicIdType is "0b11". TopicName: the long topic name if the topicIdType is "0b11".  If a connection has not been established, the only QoS that can be used is -1.  In these circumstances, a registered topic id cannot be used as there is no means for registration.  Pre–registered topic ids, short and long topic names can be used with QoS -1.    

      Description

      In both MQTT 5.0 and MQTT-SN topic ids can be used instead of a full topic string. However, in MQTT-SN this is almost compulsory, because the PUBLISH packet’s one variable length field is the payload. The topic data is limited to a two byte field to hold a topic id (2 byte integer) or a short topic string (2 bytes). In MQTT 5.0 the topic id is registered by including it in the publish packet along with the long topic string. In MQTT-SN this registration is delegated to a separate packet, REGISTER, which must be sent before sending a PUBLISH packet. This applies to both clients and servers.

      This does lead to a problem when using the PUBLISH packet in a QoS -1 mode, which is exclusive to MQTT-SN. QoS -1 in MQTT-SN means that a client can send a message to a server outside of the familiar CONNECT/DISCONNECT session start and end range. Typically this could be used in a multi-cast environment where the client is not sure of the location of the server. There are a number of proposals to allow a variable length topic name to be included in a PUBLISH packet. At least one has already been implemented, which is to use the spare topic id type indicator to specify that the topic name is variable length field, and the topic id integer holds the length. This would mean the PUBLISH packet is the only one with two variable length fields (topic name and payload). I would advocate allowing this format for all PUBLISH QoS.

        Attachments

          Activity

            People

            • Assignee:
              ian.craggs Ian Craggs
              Reporter:
              ian.craggs Ian Craggs
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: