Stand with Ukraine flag

MQTT GUIDE

3 min read

What Is MQTT? A Beginner's Guide to the Protocol

Quick answer

MQTT (Message Queuing Telemetry Transport) is a lightweight publish/subscribe messaging protocol built for constrained devices and low-bandwidth, unreliable networks. Clients publish messages to named topics on a central broker, which forwards each message to every client subscribed to that topic — decoupling senders from receivers.

How MQTT works

MQTT follows a publish/subscribe model instead of the request/response model of HTTP. Clients never talk to each other directly. Instead, a publisher sends a message to a topic on a central broker, and the broker forwards that message to every client that has subscribed to the topic. Publishers and subscribers are fully decoupled — they don't need to know about each other, run at the same time, or even know how many receivers exist.

A typical setup has three roles: publishers (for example, sensors sending readings), subscribers (for example, a dashboard or backend service), and the broker that connects them. A single client can both publish and subscribe.

For the protocol-level details — the MQTT control packet types, their structure, and how messages flow through the broker — see the MQTT protocol reference in the TBMQ docs.

PUBLISHER SUBSCRIBERS Thermostat BROKER home/temp Dashboard Data logger Phone app publish copy One message in → a copy to every subscriber Publisher and subscribers share only the topic — never each other
A publisher sends one message to a topic; the broker delivers a copy to every subscriber

Why MQTT is used for IoT

MQTT was designed for constrained devices and unreliable networks, which is exactly the environment most IoT fleets live in. Its advantages:

Lightweight

A compact fixed header — just 2 bytes at minimum — keeps overhead and battery use low.

Resilient

Persistent connections, QoS levels, and Last Will messages handle flaky links gracefully.

Scalable

The decoupled pub/sub model lets one broker fan a message out to many subscribers efficiently.

Stateful when needed

Persistent sessions and retained messages keep clients in sync across reconnects.

MQTT vs HTTP

HTTP is request/response: a client asks, the server answers, and the connection is typically short-lived. That's a poor fit for pushing frequent, small updates to many devices. MQTT keeps a long-lived connection open and pushes messages the instant they're published, with far less per-message overhead. See MQTT vs HTTP for a fuller comparison. For moving that device data into backend analytics pipelines, MQTT is often paired with a streaming platform — see MQTT vs Kafka.

Core MQTT concepts

Once the pub/sub basics click, these are the concepts worth knowing next:

Frequently asked questions

What does MQTT stand for?

MQTT originally stood for Message Queuing Telemetry Transport. Today it is simply the protocol name — it is not tied to any specific message-queue product.

Is MQTT open source?

MQTT is an open OASIS and ISO standard, not a product, so anyone can implement it. There are many open-source brokers and clients, including the open-source TBMQ broker.

What port does MQTT use?

MQTT uses TCP port 1883 by default, and 8883 for MQTT over TLS. Over WebSocket the port varies by broker — TBMQ uses 8084 for WS and 8085 for WSS.

Is MQTT secure?

MQTT itself is a messaging protocol; security is added by running it over TLS for encryption, plus authentication and topic authorization enforced at the broker.

What is an MQTT broker?

The broker is the central server that receives every published message and routes it to the clients subscribed to the matching topic. TBMQ is one example of an MQTT broker.

Run it yourself

TBMQ is a free, open-source MQTT broker built to scale. Spin it up in minutes or try the live demo — no install required.