The MQTT protocol links remote gear across distributed networks [4]. Dr. Andy Stanford-Clark of IBM and Arlen Nipper of Arcom Control Systems created the technology in 1999 to monitor oil pipelines using satellite links [3]. The architecture relies on a central broker that routes telemetry records between field hardware and enterprise databases without requiring direct device-to-device links [5]. Because remote sensors transmit updates only when measured values change, this publish-subscribe topology conserves battery reserves while cutting data transfer costs for thousands of concurrent microchips [6].
- Origins of the MQTT Protocol
- How the Publish-Subscribe Model Operates
- Message Format and Packet Structure
- Quality of Service Levels
- MQTT Protocol Enhancements in Version 5.0
- Why MQTT Protocol Fits Constrained Networks
- Clustering Approaches for Distributed Brokers
- Security Protections and Known Vulnerabilities
Origins of the MQTT Protocol
When engineers designed the MQTT protocol in 1999, oil pipelines ran through harsh remote territory where telephone lines or radio towers did not exist. Dr. Andy Stanford-Clark of IBM and Arlen Nipper of Arcom Control Systems (now Eurotech) built the messaging system to report sensor telemetry back to central SCADA monitoring hosts [3]. Satellite airtime was very expensive and billed by data volume [5]. Field devices needed a lean format that consumed minimal electric power while surviving broken links. The initial acronym referenced IBM’s MQSeries product line, where MQ stood for message queue [3].
Despite the name, the design never uses message queues [3]. IBM opened version 3.1 to external programmers before submitting the specification to OASIS in 2013 under a charter that restricted changes to minor clarifications so existing systems would not break [13]. Since 2013, the letters do not formally stand for anything, and standards bodies refer to the technology simply as MQTT.
OASIS approved version 3.1.1 on October 29, 2014, and the International Organization for Standardization later ratified that document as ISO/IEC 20922 [3]. OASIS Technical Committee chairs Richard Coppen and editors Andrew Banks, Ed Briggs, Ken Borgendale, and Rahul Gupta later developed MQTT version 5.0, which OASIS approved on March 7, 2019 [1]. In parallel, the Eclipse Foundation advanced open-source tools through Eclipse Paho and the Eclipse Mosquitto broker project, providing client libraries for C, Python, Java, and Go [6]. This open ecosystem allowed global hardware vendors to embed standard clients into commercial meters, factory sensors, and industrial controllers without paying licensing fees.

How the Publish-Subscribe Model Operates
The MQTT protocol topology splits network responsibilities between a central broker and connected clients. A client can be an Arduino microcontroller, an industrial valve, or a backend database server. Senders and receivers remain decoupled across space, time, and synchronization boundaries [4]. Publishers never track subscriber internet addresses, and subscribers never manage direct connections to individual field transmitters [3].
Messages travel under topic strings structured as hierarchical directory paths separated by forward slashes. For example, a temperature sensor might publish data to sensors/OilandGas/Pressure/ without an administrator configuring that topic beforehand on the broker [5]. Subscribers use wildcards to register interest across multiple streams at once: a plus sign matches a single topic level, whereas a hash character matches all descendant subtopics beneath that point in the hierarchy [2]. Field devices filter incoming telemetry by subscribing only to relevant branch topics, which cuts unwanted radio chatter across bandwidth-limited remote links [4].
Brokers drop incoming packets if nobody subscribes, unless the sender turns on the retain flag [3]. When retained, the broker saves the last known good value and delivers it to new subscribers the instant they join [2]. Senders can clear this stored value by issuing an empty message with the retain flag enabled. Clients also register a last will message during link setup [4]. If a field node drops offline unexpectedly, the broker automatically publishes that emergency text to inform listening services [5].
Message Format and Packet Structure
In the MQTT protocol, network communication runs over ordered, reliable transport stacks, primarily TCP/IP [1]. Default unencrypted traffic travels through IANA port 1883, while encrypted channels run over port 8883 [3]. When evaluating transport layers for edge systems, comparing network data delivery with TCP vs UDP explains why standard broker links rely on TCP connection handshakes to prevent data loss. Every packet starts with a fixed header that takes just two bytes in its smallest form [5]. Fourteen control types govern connections, publications, subscriptions, and heartbeats, including CONNECT, PUBLISH, and PINGREQ [2].
Byte two begins the remaining length field. The protocol uses a variable byte scheme where each byte stores seven data bits and one continuation bit to encode message sizes without wasting packet space. One byte handles payloads up to 127 bytes, while four bytes can encode payloads up to 256 megabytes (256 MB) [2]. The most significant bit of each length byte indicates whether additional multiplier bytes follow in the incoming stream.

Packets like CONNECT, PUBLISH, and SUBSCRIBE place a variable header between the fixed header and payload [2]. This section holds packet IDs, protocol version numbers, and session flags. The payload contains the actual message data. Because the protocol is completely payload-agnostic, clients can transmit plain text, serialized JSON, XML documents, or compressed binary sensor frames without the broker inspecting inner byte contents [4]. Senders and receivers agree on data formats beforehand. An industrial gauge might send raw binary bytes, while a building monitor publishes a JSON string containing temperature and humidity readings.
Quality of Service Levels
How does a lean protocol assure delivery over patchy radio links? The MQTT protocol defines three Quality of Service (QoS) levels to balance network cost against delivery guarantees [1]. QoS 0 delivers data at most once without acknowledgment [2]. Packets travel fire-and-forget style. If a connection drops during transit, the reading is lost permanently, making this level suitable for high-frequency environmental sensors where missing an occasional sample does not impair overall system monitoring [1].
QoS 1 guarantees at least once delivery using an acknowledgment exchange. The publishing client stores the packet locally in memory and resends it with a duplicate flag if the receiver fails to return a PUBACK confirmation within a configured timeout window [2]. However, if the acknowledgment packet gets lost in transit, the sender transmits the message again, causing the receiver to see a duplicate record [5]. Applications consuming QoS 1 streams must include deduplication logic, such as tracking unique message IDs, to prevent duplicate database writes. Industrial telemetry often relies on this tier because missing an alarm reading is far worse than handling two copies.
QoS 2 delivers messages exactly once through a coordinated four-part handshake [1]. The publisher sends PUBLISH, the receiver returns PUBREC, the sender releases via PUBREL, and the receiver confirms with PUBCOMP [2]. This exchange eliminates both lost and duplicated records. Under persistent sessions, the broker safely queues pending QoS 1 and QoS 2 messages for offline hardware until the client reconnects and asks for backlog delivery [5].

MQTT Protocol Enhancements in Version 5.0
Standardizing the MQTT protocol under version 5.0 brought major upgrades for cloud systems while preserving backward compatibility [1]. Released by OASIS in March 2019, version 5.0 added detailed reason codes to all acknowledgment packets, including CONNACK, PUBACK, and DISCONNECT. In older editions, when a broker rejected a client connection, it closed the TCP socket without explanation. Now, servers return explicit numeric reason codes and optional diagnostic text strings that tell client applications whether authentication failed, a quota was exceeded, or a topic name was malformed. Brokers can also transmit a DISCONNECT packet before closing an active connection to inform field devices of maintenance windows or server shutdowns [14].
Session handling saw another major improvement. The old CleanSession boolean was split into a Clean Start flag and a configurable Session Expiry Interval measured in seconds, allowing clients to resume stored sessions after brief disconnections [14]. Message expiry intervals also let publishers set lifespans, and the broker discards stale telemetry automatically if network delays exceed that threshold [3].
Version 5.0 also introduced topic aliases, which substitute long text paths with short two-byte integers after an initial publish exchange. Shared subscriptions distribute message loads across groups of worker clients using the $share topic prefix, providing native horizontal scaling without external load balancers. User properties add custom key-value metadata to headers, helping distributed backends trace and route messages without modifying application payloads [14]. In addition, flow control mechanisms allow brokers and clients to independently set receive quotas that restrict how many unacknowledged reliable messages can remain in flight at any single moment [8]. System operators tune these quotas to prevent memory exhaustion during traffic spikes.

Why MQTT Protocol Fits Constrained Networks
Why do engineers pick this standard over HTTP web services for connected hardware? HTTP relies on synchronous request-response exchanges where clients must open new TCP connections and poll servers repeatedly. HTTP headers add hundreds of bytes of ASCII text to every ping. In contrast, MQTT maintains a single persistent TCP connection with minimal binary headers, allowing battery-powered field microchips to publish telemetry readings and receive downstream commands without continuous server polling [4].
Deploying the MQTT protocol in constrained sensor networks offers clear benefits over rival enterprise protocols [8]. Systems like AMQP (Advanced Message Queuing Protocol) provide rich enterprise messaging features, yet their heavy specifications require substantial memory and computing resources that easily overwhelm simple field microcontrollers. Similarly, protocols like XMPP rely on continuous XML parsing, which drains battery reserves and strains chip memory [4]. MQTT keeps code footprints small, allowing lightweight client libraries to run smoothly on constrained hardware such as ESP8266 modules, Arduino boards, and industrial edge gateways [8]. Developers can compile functional client libraries into microcontrollers possessing less than thirty-two kilobytes of random access memory [4].
For wireless devices that cannot run TCP/IP, engineers use MQTT-SN (MQTT for Sensor Networks) [7]. Running over UDP, Zigbee, or Bluetooth, MQTT-SN replaces text topic names with two-byte IDs and adds a QoS -1 tier [3]. Under QoS -1, sleeping nodes wake up, send a single unacknowledged datagram without opening a handshake connection, and return immediately to low-power sleep mode. Specialized gateways like the Eclipse Paho gateway translate these UDP packets into regular MQTT broker connections [7].
Clustering Approaches for Distributed Brokers
While the base MQTT protocol standardizes client-to-broker exchanges, the official specification omits rules for server-to-server communication, leaving multi-broker networking to vendor implementation designs. Production deployments requiring high availability and horizontal capacity rely on either broker bridging or clustering architectures. In bridging setups, such as in Eclipse Mosquitto, one broker connects as a client to another broker and forwards designated topic trees across corporate network boundaries [3].
Clustered platforms like HiveMQ and EMQX bind multiple physical server nodes into a single logical broker. Nodes share client sessions, topic subscriptions, and routing state over high-speed interconnects. To synchronize cluster metadata, session storage, and leader election without split-brain errors, distributed brokers often apply consensus algorithms like the Raft consensus algorithm across member nodes. HiveMQ supports discovery via static IP lists, UDP multicast, or subnet IP broadcast, giving administrators flexibility when expanding clusters [12]. In EMQX, an Erlang/OTP foundation provides built-in distribution mechanisms that handle millions of concurrent client connections across clustered nodes [15].

Academic research explores decentralized routing alternatives to reduce edge latency. In a 2019 study, Edoardo Longo and colleagues proposed MQTT-ST, a protocol that organizes edge brokers into a spanning tree structure using native MQTT control primitives. It is worth noting that this 2019 study appeared as an unreviewed preprint on arXiv [11]. In related research, J. Park, H. Kim, and W. Kim developed DM-MQTT, which establishes bidirectional SDN multicast trees to reduce data transfer delays in massive IoT environments [8]. Furthermore, S. E. Quincozes, E. R. R. Tubino, and J. F. Kazienko published an extensive survey in IEEE Latin America Transactions, comparing MQTT latency directly against the Constrained Application Protocol (CoAP) [10].
Security Protections and Known Vulnerabilities
Securing the MQTT protocol against network risks requires careful transport configuration [3]. In its native form, the protocol transmits all data packets in clear text, passing usernames and passwords unencrypted inside the CONNECT packet over untrusted network links [2]. To secure operational hardware, administrators deploy Transport Layer Security (TLS) over port 8883 [3]. TLS provides cryptographic encryption across the transport layer and enables mutual authentication (mTLS) through client certificates, though it introduces computational overhead for constrained sensor boards [6].
Network implementations also face targeted denial-of-service vulnerabilities. In version 3.1.1, brokers maintain client keepalive sessions up to one-and-a-half times the duration requested by the client. Security researchers identified this behavior as the source of the SlowITe attack in 2020, where malicious endpoints open hundreds of slow connections to exhaust broker socket pools and deny access to legitimate devices [3]. To counter these attacks, administrators configure connection rate limits, enforce aggressive keepalive timeouts, and deploy automated intrusion detection models that isolate suspicious nodes before socket pools fill [9].
To test automated defenses, I. Vaccari, G. Chiola, M. Aiello, M. Mongelli, and E. Cambiaso introduced the MQTTset dataset in 2020, combining legitimate traffic with simulated attacks to train machine learning classifiers [9]. In parallel studies, A. Haripriya and K. Kanagasabai proposed Secure-MQTT in the EURASIP Journal on Wireless Communications and Networking, applying fuzzy logic interpolation to identify denial-of-service attempts in resource-constrained environments. Furthermore, in 2023, A. Alatram, L. F. Sikos, M. Johnstone, P. Szewczyk, and J. J. Kang released the DoS/DDoS-MQTT-IoT dataset to benchmark physical testbeds against ten distinct attack scenarios [8]. These defensive frameworks help system administrators isolate compromised nodes before security incidents disrupt operations [9].
- REPORT Banks, A., Briggs, E., Borgendale, K., & Gupta, R. (Eds.). (2019). MQTT Version 5.0 (OASIS Standard). [Article Link]
- REPORT IBM. (2010). MQTT V3.1 Protocol Specification. [Article Link]
- WEBSITE Wikipedia contributors. (2026). MQTT. [Article Link]
- WEBSITE Yuan, M. (2017). What Is MQTT? Why Use MQTT? Why MQTT Is One of the Best Network Protocols for the Internet of Things. IBM Developer. [Article Link]
- WEBSITE Paessler. (2026). MQTT: Message Queuing Telemetry Transport. [Article Link]
- WEBSITE MQTT.org. (2024). Frequently Asked Questions. [Article Link]
- WEBSITE Cope, S. (2017). Introduction to MQTT-SN (MQTT for Sensor Networks). [Article Link]
- ACADEMIC JOURNAL Mishra, B., & Kertész, A. (2020). The Use of MQTT in M2M and IoT Systems: A Survey. IEEE Access, 8, 201071–201086. [Article Link]
- ACADEMIC JOURNAL Vaccari, I., Chiola, G., Aiello, M., Mongelli, M., & Cambiaso, E. (2020). MQTTset, a New Dataset for Machine Learning Techniques on MQTT. Sensors, 20(22), 6578. [Article Link]
- ACADEMIC JOURNAL Quincozes, S. E., Tubino, E. R. R., & Kazienko, J. F. (2019). MQTT Protocol: Fundamentals, Tools and Future Directions. IEEE Latin America Transactions, 17(09), 1439–1448. [Article Link]
- PREPRINT Longo, E., Redondi, A. E. C., Cesana, M., Arcia-Moret, A., & Manzoni, P. (2019). MQTT-ST: A Spanning Tree Protocol for Distributed MQTT Brokers. arXiv:1911.07622. [Article Link]
- WEBSITE HiveMQ. (2022). HiveMQ MQTT Broker Clusters. [Article Link]
- REPORT OASIS. (2021). OASIS Message Queuing Telemetry Transport (MQTT) Technical Committee Charter. [Article Link]
- WEBSITE MQTT.org Community. (2018). Differences Between 3.1.1 and 5.0. [Article Link]
- WEBSITE EMQX Docs. (2024). Introduction to EMQ X Broker. [Article Link]