Skip to content

MQTT Specification Notes

General Definitions

Application Message

When an Application message is transported by MQTT it contains payload data, a QoS, a collection of properties, and a Topic Name

Subscription

A subscription contains a Topic Filter and a Max QoS. A sub is associated with one session but there can be multiple subs in a session. Each sub contains a different Topic Filter.

Shared Subscription

contains Topic Filter and max QoS. A shared sub can be associated with more than one session. An application message that matches a shared sub is only sent to the client associated with one of these sessions. Think like client clustering. 3 clients may subscribe to a shared topic and when it gets published the broker selects 1 of the clients to send it to. (Normally round robin style) I would think for this to be appropriate, the clients would be communicated to each other with the data when 1 receives it. Kind of like load balancing in a way. or having two ignition gateways both subbed to the same topics would cause each gateway to process each pub, potentially creating conflicts.

wildcard subscription

allows for a subscription to match with more than one topic name.

MQTT Control Packet

mqtt defines fifteen different types of MQTT Control Packet.

Malformed Packet

A control packet that cannot be parsed by the MQTT spec

Protocol Error

An error that is detected after the packet has been parsed out and found to contain data that is not allowed by the protocol or is inconsistent with the state of the client or server

Will Message

An application message that is published by the server after the network connection is closed in cases where the network connection does not close normally.

Data Representation

Bits

bits in a byte are labelled 7 -> 0 with bit 7 being the most significant. Least significant is 0.

Two Byte Integer

It is a 16 bit unsigned integers in big-endian order. 16 bits gives a max integer of 65,535. The higher order byte precedes the lower order byte. This means a 16 bit word is presented as Most Significant Byte (MSB) then Least Significant Byte (LSB).

Refer to Binary Counting and Hex Counting / Binary Conversion for more information.

Four Byte Integer

Four byte integers are similar to two byte integers but use 32 bits instead of 16, giving a max of 4,294,967,295. Still presented from MSB to LSB.

Refer to Binary Counting and Hex Counting / Binary Conversion for more information.

Refs