MQTT is a messaging protocol designed for small devices on unreliable networks. A device opens one TCP connection to a central server, called a broker, and publishes short messages to topics. Any client that has subscribed to a topic receives the message. Publishers and subscribers never talk directly, which makes it easy to add a dashboard, a database or a cloud service without touching the devices. Andy Stanford-Clark of IBM and Arlen Nipper of Arcom created MQTT in 1999 for monitoring oil pipelines over satellite links. The OASIS committee that maintains it is named "Message Queuing Telemetry Transport", but the standards simply call it MQTT.
Versions
- MQTT 3.1.1 became an OASIS Standard in October 2014 and was later published as ISO/IEC 20922. It is still very widely supported.
- MQTT 5.0 became an OASIS Standard in March 2019. It adds reason codes on acknowledgements, shared subscriptions for load-balancing consumers, message and session expiry, topic aliases and user properties. IANA reserves port 1883 for MQTT and 8883 for MQTT over TLS.
QoS levels
Each message is published with a Quality of Service level:
| QoS | Guarantee | How |
|---|---|---|
| 0 | At most once | Sent once, no acknowledgement. May be lost |
| 1 | At least once | Resent until a PUBACK arrives. May arrive twice |
| 2 | Exactly once | Four-step handshake (PUBLISH, PUBREC, PUBREL, PUBCOMP) |
| QoS applies to each hop, from publisher to broker and from broker to subscriber. QoS 1 is the usual choice for telemetry, with consumers written to handle duplicates (see idempotency). | ||
| Three other features matter in practice. A retained message is the last value kept on a topic, so a new subscriber gets the current state at once. A last will is a message the broker publishes if a client disconnects unexpectedly. A persistent session keeps a client's subscriptions and queued messages while it is offline. |
Example: machine state from a factory line
An edge gateway on line 2 publishes each machine's state as JSON, with QoS 1 and the retain flag set:
Topic: plant/rajkot/line2/press07/state
Payload: {"state":"DOWN","reason":"die_change","ts":"2026-11-21T09:42:10+05:30"}
A dashboard subscribes to plant/rajkot/+/+/state, where + matches one level. An OEE service subscribes to plant/rajkot/#, where # matches everything below. Both get the message. If the gateway loses power, its last will sets press07/status to offline, so nobody mistakes silence for a running machine.
MQTT vs HTTP
HTTP is request-response: the client asks and the server answers, with headers on every call. MQTT keeps one connection open and pushes messages both ways, and a fixed header that can be as small as 2 bytes. That suits thousands of devices sending small, frequent readings. HTTP still suits occasional uploads, file transfers and public APIs. MQTT carries messages but doesn't define what they mean. Agree on topic names and payload formats early, or combine it with OPC UA information models. We design these data pipelines in our manufacturing projects.