Fundamentals 6 min read

An Overview of the MQTT Protocol: History, Requirements, and Message Format

This article provides a comprehensive overview of the MQTT protocol, covering its origin in 1999, the problems it addresses, and detailed explanations of its fixed header, variable header, and payload structures, along with practical considerations for IoT applications.

360 Tech Engineering
360 Tech Engineering
360 Tech Engineering
An Overview of the MQTT Protocol: History, Requirements, and Message Format

Introduction The MQTT protocol is a lightweight, publish‑subscribe messaging system designed for low‑bandwidth, high‑latency networks, commonly used in IoT scenarios such as home automation, HVAC, lighting, and security.

History Invented in 1999 by Andy Stanford‑Clark (IBM) and Arlen Nipper (Arcom) to minimize battery consumption and bandwidth for satellite‑linked oil‑pipeline monitoring, MQTT was defined with five core requirements: simple implementation, QoS‑aware data transfer, lightweight and bandwidth‑efficient design, data agnosticism, and persistent session awareness.

Protocol Format An MQTT control packet consists of a fixed header, an optional variable header, and an optional payload. The fixed header is always two bytes, where the first byte encodes the packet type (bits 7‑4) and specific flags (bits 3‑0). The second byte (and up to three additional bytes) encodes the remaining length using a variable‑length scheme.

Fixed Header Details The packet type values include CONNECT, CONNACK, PUBLISH, PUBACK, PUBREC, PUBREL, PUBCOMP, SUBSCRIBE, SUBACK, UNSUBSCRIBE, UNSUBACK, PINGREQ, PINGRESP, and DISCONNECT. Flags are packet‑type‑specific and must be set correctly; otherwise the receiver must close the connection.

Variable Header Present only in certain packet types, the variable header may contain fields such as Packet Identifier (two bytes) used by PUBLISH (QoS > 0), PUBACK, PUBREC, PUBREL, PUBCOMP, SUBSCRIBE, SUBACK, UNSUBSCRIBE, and UNSUBACK. The article lists the specific packets that include this header.

Payload The payload carries the application message. In MQTT 3.1.1 it appears in packets like CONNECT, CONNACK, PUBLISH, PUBACK, PUBREC, PUBREL, PUBCOMP, SUBSCRIBE, SUBACK, UNSUBSCRIBE, UNSUBACK, PINGREQ, PINGRESP, and DISCONNECT. Detailed formats for each will be covered in future articles.

Considerations MQTT’s binary, bit‑level precision makes it well‑suited for IoT, but its lack of packet fragmentation limits suitability for large data transfers such as video streaming.

Conclusion MQTT’s efficient, bit‑accurate design secures its place in the IoT ecosystem, though it is not ideal for scenarios requiring large payloads or packet segmentation.

IoTMessaging ProtocolMQTTFixed HeaderpayloadProtocol FormatVariable Header
360 Tech Engineering
Written by

360 Tech Engineering

Official tech channel of 360, building the most professional technology aggregation platform for the brand.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.