Buffl

Application Protocols

CF
by Carmen F.

Meaning of “Message Type”, “DUP”, “QoS”, “RET” of MQTT?

The first MQTT field in the header is Message Type, which identifies the kind of MQTT packet within a

message. Fourteen different types of control packets are specified in MQTT version 5.0. Each of them

has a unique value that is coded into the Message Type field. Note that value 0 is reserved.

DUP (Duplication Flag): This flag, when set, allows the client to notate that the packet has been sent

previously, but an acknowledgement was not received.

The QoS header field allows for the selection of three different QoS levels.

The next field is the Retain flag. Only found in a PUBLISH message, the Retain flag notifies the server to

hold onto the message data. This allows new subscribers to instantly receive the last known value

without having to wait for the next update from the publisher.

The last mandatory field in the MQTT message header is Remaining Length. This field specifies the

number of bytes in the MQTT packet following this field.

Securing MQTT connections through TLS is considered optional because it calls for more resources on

constrained nodes. When TLS is not used, the client sends a clear-text username and password during

the connection initiation. MQTT server implementations may also accept anonymous client

connections (with the username/password being “blank”). When TLS is implemented, a client must

validate the server certificate for proper authentication. Client authentication can also be performed

through certificate exchanges with the server, depending on the server configuration.

Author

Carmen F.

Information

Last changed