What is MQTT Protocol?

MQTTIoTCommunicationM2MCloud

MQTT (Message Queuing Telemetry Transport) is a lightweight publish/subscribe messaging protocol running over TCP, designed for networks with limited bandwidth or unstable connections. It was developed in 1999 to monitor oil pipelines over satellite links and is now an OASIS standard (common versions are 3.1.1 and 5.0).

How does MQTT work?

Unlike the request/response model of Modbus, devices that produce and consume data in MQTT do not know each other. A broker (server) in the middle handles all traffic:

  1. A publisher publishes a message to a topic.
  2. A subscriber subscribes to the topics it cares about.
  3. The broker forwards each message to everyone subscribed to that topic.

The default port is 1883 for plain connections and 8883 with TLS. The fixed header is as small as 2 bytes, so overhead on small sensor messages is low.

Example: topic structure and QoS

Consider a gateway publishing weighing data from a plant:

  • Topic: konya-plant/line1/scale1/weight
  • Payload: {"value": 1250.4, "unit": "kg", "ts": "2026-11-23T10:15:00Z"}

Subscribers can use two wildcards:

  • konya-plant/line1/+/weight → the weight of every scale on line 1 (+ is a single level).
  • konya-plant/line1/# → everything on line 1 (# is multi-level, only at the end).
QoSGuaranteeOverheadWhen
0At most once (may be lost)LowestFrequent readings where a lost sample does not matter
1At least once (may duplicate)MediumMost telemetry and alarms
2Exactly onceHighest (4-step handshake)Counters, commands where duplicates are harmful

Other key features

  • Retained message: the broker stores the last value on a topic; a new subscriber gets the current state immediately.
  • Last Will (LWT): if a client disconnects unexpectedly, the broker publishes a predefined message (e.g. status = offline).
  • Keep-alive and persistent session: QoS 1/2 messages can be queued in a persistent session while a client is offline.

Common mistakes

  • Starting a topic with /: it creates an empty level and confuses subscription matching.
  • Using QoS 2 everywhere: it adds traffic and latency for no benefit.
  • Two devices with the same Client ID: the broker drops one, and the devices keep kicking each other off.
  • A broker without authentication or TLS: an internet-facing port 1883 is a serious security hole.
  • Subscribing to #: in large systems it floods the client with data it does not need.

Where is it used in industry?

It has become the standard way to move values read from field Modbus devices to the cloud, SCADA or a database. In a typical architecture a gateway polls RS-485 Modbus devices such as the Amazeng ZMA and publishes the values over MQTT. For more see the IoT entry, our industrial data collection with AWS IoT Core post and our cloud IoT data collection solution.

Related Terms