MQTT (Message Queuing Telemetry Transport) is a lightweight, publish-subscribe network protocol designed for constrained devices and low-bandwidth, high-latency networks. It operates over TCP/IP and uses a central broker to manage message distribution between clients, making it highly efficient for machine-to-machine (M2M) communication and telemetry data collection in edge and IoT environments.
Glossary
MQTT

What is MQTT?
MQTT is the lightweight, publish-subscribe messaging protocol standard for machine-to-machine communication in IoT and edge AI systems.
The protocol's minimal overhead and quality-of-service levels enable reliable, bidirectional communication ideal for edge AI deployment. It allows sensor data to be published to topics and for on-device models to subscribe to relevant data streams, facilitating real-time inference and control. Its design aligns with the principles of edge computing, supporting decentralized, resilient systems that operate with intermittent cloud connectivity.
Key Features of MQTT
MQTT (Message Queuing Telemetry Transport) is a lightweight, open-standard messaging protocol designed for constrained devices and unreliable networks. Its core architecture is built around a publish-subscribe model, enabling efficient machine-to-machine communication for edge AI and IoT systems.
Publish-Subscribe Pattern
MQTT operates on a publish-subscribe (pub/sub) messaging pattern, decoupling message producers (publishers) from consumers (subscribers) via a central broker. This architecture is fundamental for scalable edge deployments.
- Publishers send messages to a topic (a hierarchical string like
sensor/device123/temperature) without knowing the subscribers. - Subscribers express interest in one or more topics and receive relevant messages from the broker.
- The broker manages all connections, filters messages by topic, and distributes them to appropriate subscribers.
This pattern enables one-to-many communication, dynamic scaling, and loose coupling between devices, which is ideal for heterogeneous fleets of edge AI agents.
Quality of Service (QoS) Levels
MQTT defines three Quality of Service (QoS) levels to guarantee message delivery across unreliable networks, a critical feature for mission-critical edge AI telemetry.
- QoS 0 (At most once): Fire-and-forget. No acknowledgment. Lowest overhead, suitable for frequent, non-critical sensor data.
- QoS 1 (At least once): Acknowledgment required. The sender stores and retransmits the message until an acknowledgment (PUBACK) is received. May result in duplicates.
- QoS 2 (Exactly once): Highest assurance. A four-step handshake ensures the message is delivered exactly once, preventing duplication. Used for critical commands or model update triggers.
Selecting the appropriate QoS level allows developers to balance reliability, latency, and bandwidth—key trade-offs in edge deployment.
Lightweight & Bandwidth Efficient
MQTT is designed for constrained devices and low-bandwidth, high-latency networks, making it a de facto standard for edge and IoT. Its efficiency stems from several design choices:
- Minimal Packet Overhead: The fixed header can be as small as 2 bytes.
- Binary Protocol: More compact than text-based protocols like HTTP.
- Persistent TCP Connections: Reduces the overhead of repeatedly establishing connections.
- Last Will and Testament (LWT): Allows a client to specify a message to be published by the broker if it disconnects ungracefully, providing a simple health-check mechanism.
This efficiency enables battery-powered edge devices with limited CPU and memory to communicate telemetry and model inference results for years.
Session Persistence & Clean Session
MQTT brokers can maintain persistent sessions for clients, which is essential for managing state in intermittently connected edge environments.
- Clean Session = false: The broker stores the client's subscriptions and any missed messages (with QoS 1 or 2) while the client is offline. Upon reconnection, the session resumes.
- Clean Session = true: No state is persisted. This creates a new, clean session each connection.
For edge AI agents that may lose connectivity, setting Clean Session to false ensures they receive all queued commands or model update notifications upon reconnection, maintaining operational continuity.
Retained Messages & Will Messages
Two powerful features for managing device state and lifecycle in edge systems are Retained Messages and Last Will and Testament (LWT).
- Retained Messages: When a publisher sends a message with the retained flag set, the broker stores the last message on that topic. Any new subscriber to that topic immediately receives this message. This is perfect for broadcasting the latest known state of a device (e.g.,
device/status = online) or a configuration payload. - Last Will and Testament (LWT): A client specifies a Will Message and Will Topic during connection. If the client disconnects unexpectedly (without sending a DISCONNECT packet), the broker publishes the Will Message to the Will Topic. This acts as a dead-man's switch, alerting the system to a device failure—a crucial observability signal for edge AI health monitoring.
Topic Wildcards & Security
MQTT provides flexible subscription mechanisms through topic wildcards and supports robust authentication and authorization.
- Wildcards: Subscribers can use
+(single-level) and#(multi-level) wildcards to subscribe to multiple topics efficiently. For example, subscribing tosensor/+/temperaturereceives messages from all devices reporting temperature. - Security: While the core protocol is simple, production deployments layer on security:
- Transport Layer Security (TLS/SSL) for encrypted connections.
- Username/Password authentication at the protocol level.
- Authorization: Modern brokers (e.g., EMQX, HiveMQ) integrate with external systems to enforce fine-grained publish/subscribe permissions per client and topic, which is vital for securing multi-tenant edge AI fleets.
How MQTT Works: The Publish-Subscribe Pattern
MQTT (Message Queuing Telemetry Transport) is a lightweight, open-standard messaging protocol built on a publish-subscribe architecture, designed for constrained devices and unreliable networks. Its core mechanism decouples data producers (publishers) from consumers (subscribers) through a central broker, making it the de facto standard for machine-to-machine (M2M) communication in edge AI and IoT systems.
In the publish-subscribe pattern, clients never communicate directly. A publisher sends a message (or payload) tagged with a hierarchical string called a topic (e.g., factory/sensor7/temperature) to a central MQTT broker. The broker's sole responsibility is to filter incoming messages and distribute them to all subscribers that have expressed interest in that specific topic. This complete decoupling allows for scalable, many-to-many communication where publishers and subscribers are anonymous to each other and can join or leave the network dynamically without disrupting the system.
The protocol's efficiency stems from its minimal packet overhead and support for Quality of Service (QoS) levels. QoS 0 (at most once) offers fire-and-forget delivery, QoS 1 (at least once) guarantees delivery via acknowledgments, and QoS 2 (exactly once) ensures no duplication—allowing developers to trade reliability for bandwidth and latency. The broker also manages persistent sessions for clients, can store messages for disconnected subscribers using retained messages, and supports last-will messages to notify others of a client's abnormal disconnection, which is critical for monitoring the health of edge AI agents and devices.
MQTT Use Cases in Edge AI & IoT
MQTT's lightweight publish-subscribe architecture is foundational for connecting distributed, resource-constrained devices in edge AI systems. Its design directly addresses the core challenges of low bandwidth, high latency, and unreliable networks.
Telemetry Data Collection
MQTT is the standard protocol for streaming sensor telemetry from edge devices to a central broker. Its efficiency is critical for high-frequency data from industrial sensors, environmental monitors, and vehicle telematics.
- Publish-Subscribe Model: Devices publish data to topics (e.g.,
factory/line1/temperature), and subscribers (like time-series databases or monitoring dashboards) receive only the data they need. - Quality of Service (QoS): Enables reliable data delivery despite network instability. QoS 0 (at most once) for non-critical metrics, QoS 1 (at least once) for important readings, and QoS 2 (exactly once) for mission-critical state changes.
- Example: A wind farm uses MQTT to transmit vibration, temperature, and power output data from hundreds of turbines to a cloud-based predictive maintenance system.
Remote Command & Control
MQTT facilitates bidirectional communication for sending commands and configuration updates to edge devices, enabling centralized management of distributed AI inference endpoints.
- Lightweight Footprint: The small packet size and low overhead are ideal for sending control signals over constrained cellular or satellite links to remote assets.
- Retained Messages & Last Will: A retained message on a command topic provides the latest configuration to any device that subscribes after a reboot. A Last Will and Testament message alerts the system if a device disconnects unexpectedly.
- Use Case: A logistics company sends routing updates and
model_switchcommands to a fleet of autonomous mobile robots (AMRs) in a warehouse, ensuring all robots receive the latest navigation model version.
Model Update & Canary Deployment
MQTT topics serve as efficient channels for orchestrating model deployment and canary releases across thousands of edge devices.
-
Topic Hierarchy for Fleet Management: A hierarchical topic structure (e.g.,
deploy/model-v2/region/eu/device-group/canary) allows for granular targeting. A central orchestrator publishes a new model artifact's location to a specific topic, and only subscribed devices initiate the download. -
Integration with OTA Systems: MQTT acts as the messaging layer for over-the-air (OTA) update platforms, notifying devices of available updates and reporting back success/failure status on a dedicated status topic.
-
Process: The deployment system publishes a message to
deploy/trigger/{model_id}. Devices in the canary group subscribe, fetch the model, validate it, and publish a confirmation or error todeploy/status/{device_id}.
Edge-to-Edge Communication
In peer-to-peer or mesh edge architectures, MQTT brokers deployed at the edge gateway level enable direct, low-latency communication between local devices without cloud round-trips.
- Local Broker Pattern: An MQTT broker runs on a local edge server or robust gateway. Devices in a factory cell or smart building publish and subscribe locally for real-time coordination.
- Reduced Latency & Bandwidth: Critical for applications like cooperative perception in autonomous systems, where vehicles or robots must share sensor fusion data in milliseconds.
- Example: In a smart factory, a vision model on one device detecting a defect publishes an alert to a local
line/stoptopic. A subscribing PLC on the same line receives the message instantly and halts the conveyor.
Health Monitoring & Observability
MQTT is used to stream device health metrics and model inference telemetry (latency, throughput, confidence scores) to central monitoring systems, forming the data backbone for AI observability.
- Standardized Payloads: Devices publish structured JSON payloads containing metrics like CPU temperature, memory usage, and
P99 inference latencyto topics liketelemetry/device/{id}/health. - Liveness/Readiness Signaling: Edge AI services can publish regular heartbeat messages. The absence of a heartbeat (detectable via the broker's connection monitoring) can trigger a liveness probe failure in an orchestrator like Kubernetes.
- Integration: These MQTT feeds populate dashboards and trigger alerts for model drift detection or hardware failures, enabling proactive maintenance.
Federated Learning Coordination
MQTT orchestrates the communication cycle in edge federated learning systems, where devices train models locally and share only weight updates.
- Synchronization Protocol: The central aggregator server publishes the global model's initial weights and training instructions to a
fl/round/starttopic. Subscribed edge devices download the model, perform local training, and publish their encrypted model updates to afl/updates/{device_id}topic. - Efficiency for Constrained Devices: Compared to HTTP, MQTT's persistent connection and low overhead reduce the energy and bandwidth cost of the many small communication rounds required in federated learning.
- Privacy by Design: MQTT can be layered with mutual TLS (mTLS) for secure channels, ensuring that raw data never leaves the device, aligning with privacy-preserving ML principles.
MQTT vs. Other Edge Communication Protocols
A technical comparison of MQTT against other common protocols used for machine-to-machine communication in edge AI and IoT deployments, focusing on architectural and operational characteristics.
| Feature / Metric | MQTT | HTTP/1.1 (REST) | CoAP | AMQP |
|---|---|---|---|---|
Primary Architecture | Publish-Subscribe (Pub/Sub) | Request-Response (Client-Server) | Request-Response / Observe | Publish-Subscribe / Point-to-Point |
Transport Layer | TCP (standard), MQTT-SN for UDP | TCP | UDP (with reliability options) | TCP |
Header Overhead (Typical) | < 10 bytes |
| < 10 bytes |
|
Message QoS Levels | 3 (0: At most once, 1: At least once, 2: Exactly once) | 1 (TCP reliability) | 4 (Confirmable/Non-confirmable, separate Ack) | 3 (At most once, At least once, Exactly once) |
Built-in Stateful Sessions | ||||
Last Will & Testament (LWT) | ||||
Native Support for Binary Data | ||||
Typical Use Case | Telemetry, Command & Control, Event Streaming | API Calls, Configuration, File Transfer | Constrained Sensor Networks (e.g., 6LoWPAN) | Enterprise Messaging, Financial Transactions |
Frequently Asked Questions
MQTT (Message Queuing Telemetry Transport) is a foundational protocol for machine-to-machine communication in edge AI and IoT systems. These questions address its core mechanisms, security, and role in modern edge deployments.
MQTT (Message Queuing Telemetry Transport) is a lightweight, publish-subscribe messaging protocol designed for constrained devices and unreliable networks. It operates on a client-broker architecture where clients (publishers) send messages to a central broker, which then routes those messages to other clients (subscribers) based on topic subscriptions. This decouples data producers from consumers, enabling scalable, one-to-many communication ideal for telemetry data from edge devices. The protocol uses TCP/IP and minimizes overhead with small packet headers, supporting three Quality of Service (QoS) levels for message delivery assurance.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
MQTT operates within a broader ecosystem of protocols, patterns, and tools essential for managing machine-to-machine communication and AI workloads at the edge.
Publish-Subscribe Pattern
The publish-subscribe (pub/sub) messaging pattern is a foundational architectural paradigm where message senders (publishers) categorize messages into topics without knowledge of the receivers. Subscribers express interest in one or more topics and only receive messages relevant to those topics. This decouples producers from consumers, enabling scalable, dynamic communication systems. MQTT is a lightweight, wire-efficient implementation of this pattern, optimized for constrained networks.
Quality of Service (QoS)
In MQTT, Quality of Service defines the guarantee of delivery for a message between client and broker. It is a critical reliability feature for edge AI telemetry.
- QoS 0 (At most once): Fire-and-forget. No delivery guarantee. Lowest overhead.
- QoS 1 (At least once): Guarantees delivery, but may result in duplicates. Requires acknowledgment.
- QoS 2 (Exactly once): Highest assurance. Guarantees the message is delivered exactly once, using a four-step handshake. This is essential for critical command-and-control messages in autonomous systems.
Last Will and Testament (LWT)
The Last Will and Testament is an MQTT feature where a client specifies a message to be published by the broker if the client disconnects ungracefully. This provides a deterministic mechanism for detecting device failure or network loss in edge deployments. For example, an AI-powered sensor can set an LWT message with a status of "offline" on its health topic. If the device loses power, the broker automatically publishes this message, alerting the monitoring system without requiring a heartbeat poll.
Retained Messages
An MQTT retained message is a message on a topic that the broker stores and sends automatically to any new subscriber that connects to that topic. This provides a "last known good value" or state snapshot. In edge AI, this is used to instantly communicate the latest sensor reading, model inference result, or system configuration to a device that just came online, eliminating the need for a separate state query and reducing synchronization latency.
AMQP (Advanced Message Queuing Protocol)
AMQP is a competing, feature-rich messaging protocol standard (ISO/IEC 19464). Compared to MQTT's simple pub/sub model, AMQP operates on a broker-based queuing model with explicit concepts of exchanges, queues, and bindings. It offers more sophisticated routing, transaction support, and security features but with significantly higher overhead. MQTT is typically preferred for simple telemetry on constrained devices, while AMQP is suited for complex enterprise messaging between servers.
CoAP (Constrained Application Protocol)
CoAP is a specialized web transfer protocol for constrained devices and networks, designed by the IETF. Like MQTT, it is lightweight, uses UDP by default, and supports observe (pub/sub-like) patterns. However, CoAP is modeled after HTTP REST, using methods like GET, PUT, POST, and DELETE, making it ideal for resource-oriented device interactions. A common architecture uses MQTT for continuous telemetry streaming and CoAP for direct device configuration and command execution.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us