What is MQTT and why is it popular for IoT?
MQTT (Message Queuing Telemetry Transport) is a lightweight publish-subscribe messaging protocol designed for constrained devices and unreliable networks. A device (client) connects to a central broker (server), subscribes to topics it is interested in, and publishes messages to topics. The broker handles all routing — publishers and subscribers are fully decoupled and do not need to know about each other. A minimal MQTT CONNECT packet is only 12-14 bytes, and a minimal PUBLISH with a short topic and small payload can be under 20 bytes.
MQTT is popular for IoT for several practical reasons. Low overhead: the protocol header is as small as 2 bytes, compared to HTTP headers that typically consume 200-800 bytes per request — this matters on metered cellular connections where you pay per byte. Push model: the broker pushes messages to subscribed devices instantly, whereas HTTP requires the device to poll the server repeatedly (wasting bandwidth and battery). Built-in reliability: three QoS levels let you trade off between delivery guarantee and overhead. Last Will and Testament (LWT): the broker can automatically publish a message when a device disconnects unexpectedly, enabling presence detection without polling. Retained messages: the broker stores the last message on each topic and delivers it immediately to new subscribers, so a device that just connected can get the current state without requesting it.
The ecosystem is another factor: MQTT brokers are well-supported (Mosquitto, EMQX, HiveMQ, AWS IoT Core, Azure IoT Hub), client libraries exist for every language and platform (including lightweight C libraries like Paho Embedded C and Eclipse Mosquitto for bare-metal and RTOS), and the protocol is an OASIS and ISO standard (ISO/IEC 20922). For most IoT use cases — telemetry upload, remote command delivery, device status monitoring — MQTT is the default choice.
Source: Networking Protocols Q&A
