what is mqtt

What Is MQTT? Publish/Subscribe, QoS and Industrial Use Cases

MQTT (Message Queuing Telemetry Transport) is a lightweight, open messaging protocol in which devices publish data to a central broker under named topics, and applications subscribe to the topics they need. Publishers and subscribers never connect to each other directly. That makes MQTT efficient over low-bandwidth, high-latency and unreliable links, and easy to scale from a few sensors to thousands of field devices.

In industrial operations, MQTT carries real-time data from PLCs (programmable logic controllers), RTUs (remote terminal units), gateways and edge systems to SCADA (supervisory control and data acquisition), historians, analytics and cloud platforms. It is also the most common transport for a Unified Namespace (UNS).

This guide explains the publish/subscribe model, how MQTT works, how it is used and secured on industrial sites, where Sparkplug B fits, and how to run it with the SIOTH® MQTT Universal Broker.

In short: MQTT = publish/subscribe through a broker + hierarchical topics + three delivery levels (QoS 0, 1, 2) + session features (retained messages, Last Will, persistent sessions) built for unreliable networks. It moves data; it does not define what the data means.

Where MQTT came from

Andy Stanford-Clark (IBM) and Arlen Nipper designed MQTT in 1999 to monitor oil pipelines over satellite links, where bandwidth was expensive and connections dropped often. That origin explains its design: a small header, outbound connections from the field, and delivery rules for unreliable networks. MQTT 3.1.1 became an OASIS standard in 2014 and the international standard ISO/IEC 20922 in 2016. MQTT 5.0 followed in 2019. Both versions are in wide use today.

Publish/subscribe explained

The problem: connections pile up

Most plants built their data architecture one project at a time: a PLC from one vendor, a SCADA system from another, a historian added later. When every system connects directly to each system it needs data from, N systems can need up to N(N-1)/2 links: 15 for six systems, 1,225 for fifty. Polling adds load. Consumers keep asking a controller whether a value changed, and every new consumer means another change on a production system.

Diagram comparing point-to-point industrial system connections with an MQTT broker architecture, showing how a broker simplifies communication between connected systems.
Figure 1. Point-to-point integration versus a broker: one connection per system instead of a web of links.

How publish/subscribe works

There are three roles. A publisher sends a message labeled with a topic. A subscriber tells the broker which topics it wants. The broker receives each message and forwards a copy to every subscriber of that topic. A pressure value is published once, and SCADA, the historian and an analytics service each receive it. When a new consumer is added next quarter, the publisher does not change.

Figure 2. Publish/subscribe in action: one message reaches every subscriber, and a new subscriber joins without any change on the publisher.

 

The pattern decouples the two sides in three ways:

  • Publishers and subscribers do not know each other’s addresses. Replace the historian and the field devices never notice.
  • Both sides do not need to be online at the same moment. Retained messages and persistent sessions fill the gap.
  • A publisher never waits for its readers, so a slow consumer cannot stall a controller.
Polling Point-to-point messaging Publish/subscribe
Who starts the flow The consumer, on a schedule The producer, to a named destination The producer, when something changes
Adding a consumer Change or load the source Change the producer No change to producers
Detects a change Up to one poll interval later Almost at once Almost at once
Best for Configuration reads, ad hoc queries Work distribution, commands Telemetry, events, state, alarms

The trade-offs are real: the broker becomes critical infrastructure, publishers cannot see who received a message, and both sides must agree on topic names and payload formats in advance.

How MQTT works

Clients and the broker

Every device or application is an MQTT client. Clients open an outbound TCP connection to the broker, by default on port 1883, or on port 8883 with TLS (Transport Layer Security). MQTT can also run over WebSocket for browser-based applications. Because field clients connect outward, the broker never opens connections into the control network, which suits firewall-segmented OT (operational technology) networks.

The protocol is compact. The fixed header can be as small as 2 bytes, and a connection stays open with small keep-alive packets, so data flows as soon as it changes instead of waiting for a polling cycle.

Topics and wildcards

Topics are text strings organized in levels separated by forward slashes, for example site-a/ro-train-2/hp-pump-a/pressure. The broker creates topics on first use, so no registration is needed. Subscribers can use two wildcards:

  • Single-level wildcard (+) matches exactly one level: site-a/+/hp-pump-a/pressure.
  • Multi-level wildcard (#) matches every level below: site-a/ro-train-2/#.
MQTT topic hierarchy diagram showing industrial device topics and subscription filters using exact matches, single-level (+), and multi-level (#) wildcards.
Figure 3. A topic tree and the subscription filters that select from it.

Wildcards work in subscriptions only, never when publishing. MQTT does not prescribe a topic structure. Agreeing on one, usually following the ISA-95 equipment hierarchy (enterprise, site, area, line, asset), is a design task in its own right and the foundation of a Unified Namespace.

Quality of Service (QoS)

QoS is set per message and applies to one hop at a time: publisher to broker, then broker to each subscriber.

Level Guarantee Packets exchanged Typical industrial use
QoS 0 At most once. No acknowledgment; a message can be lost. PUBLISH High-rate telemetry, where the next sample replaces a lost one
QoS 1 At least once. Delivery is confirmed; duplicates are possible. PUBLISH, PUBACK Events, alarms and state changes, with consumers that tolerate repeats
QoS 2 Exactly once, through a four-step handshake. PUBLISH, PUBREC, PUBREL, PUBCOMP Cases where a duplicate causes harm, such as some commands or counters

 

Figure 4. The three MQTT QoS levels and the packets each one exchanges on a single hop.

Two details matter in design. A subscriber receives a message at the lower of the publish QoS and its own subscription QoS. And an acknowledgment from the broker confirms only that the broker received the message, not that any subscriber did. Higher QoS adds latency and broker state, so QoS 2 everywhere is rarely the right default.

Retained messages, Last Will and sessions

Four features address the failure modes of field networks:

  • Retained message. The broker keeps the last value published on a topic with the retain flag and sends it to every new subscriber, so a dashboard that starts late shows the current setpoint or machine mode at once.
  • Last Will and Testament (LWT). When a client connects, it registers a will message. If the client disappears without disconnecting cleanly, the broker publishes the will on its behalf, so consumers see “offline” instead of a stale value.
  • Keep-alive. Client and broker exchange small ping packets, so a dead connection is detected within about 1.5 times the keep-alive interval.
  • Persistent session. The broker keeps a client’s subscriptions and queues QoS 1 and 2 messages while it is offline, so a restarted historian resumes where it stopped.
Figure 5. Last Will and Testament: when an edge gateway drops off the network, the broker publishes its offline status and the dashboard stops trusting the last value.

MQTT 3.1.1 vs MQTT 5.0

Capability MQTT 3.1.1 MQTT 5.0
Error reporting Limited return codes Reason codes on every acknowledgment
Load sharing between consumers Not standard Shared subscriptions
Message lifetime No expiry Message expiry interval
Bandwidth Full topic name in every message Topic aliases
Metadata None User properties and content type
Session control Clean session flag Session expiry interval
Authentication Username and password Username and password, plus enhanced (challenge/response) authentication

The client declares its protocol version when it connects, and most brokers accept both. New projects benefit from MQTT 5.0 where every client supports it.

Benefits and limitations

Benefits

  • Efficient on constrained links. Small headers, report-by-exception publishing and persistent connections reduce traffic over cellular, satellite and radio links.
  • Decoupled architecture. Consumers are added or replaced without touching field devices or controllers.
  • Outbound connections. Field clients connect out to the broker, which simplifies firewall rules at the OT boundary.
  • Built for unreliable networks. QoS, persistent sessions, retained messages and Last Will handle dropped links and late joiners.
  • Open and widely supported. An OASIS and ISO/IEC standard, with client libraries for most languages and support in many PLCs, gateways and cloud platforms.

Limitations

  • No payload semantics. MQTT does not define data types, units, timestamps or data quality. Sparkplug B or a project convention has to.
  • Security depends on configuration. MQTT supports username and password authentication, and MQTT 5.0 adds enhanced authentication, but encryption relies on TLS and topic-level authorization is a broker feature. An unconfigured broker is open.
  • Not for deterministic control. Messages pass through a broker over TCP, so timing is not guaranteed. Keep fast control loops on deterministic networks.
  • The broker is critical infrastructure. It needs high availability, monitoring and capacity planning.
  • Not designed for bulk transfer. The protocol allows payloads up to 256 MB, but large files and datasets are better moved over HTTP or file transfer protocols.

MQTT in industrial operations

MQTT has become a core protocol of the Industrial Internet of Things (IIoT). Typical uses:

  • Remote and dispersed assets. Wellheads, pipelines, pumping stations and remote water supply sites reporting over cellular or satellite links, where report-by-exception keeps data costs down.
  • Site-to-enterprise telemetry. Plant data streamed to central SCADA, historians, data lakes and cloud analytics without opening inbound connections into OT.
  • Condition monitoring. Vibration, temperature and motor current published continuously to analytics and machine learning (ML) models for predictive maintenance.
  • Energy monitoring. Frequent, low-overhead updates from meters and power monitors across a site.
  • Unified Namespace. MQTT as the event-driven backbone where every system publishes its current state and any authorized application subscribes.

A typical industrial MQTT architecture

Most sites use layers. Gateways or edge software read the protocols already on the floor (OPC UA, Modbus, DNP3 and vendor PLC protocols) and publish to MQTT. A broker in the plant network keeps local consumers running if the wide-area link fails. Data reaches the enterprise through the industrial DMZ (demilitarized zone): the OT side opens its connections outbound, so no inbound firewall rule into the control network is needed. For the wider security model, see What is IT/OT convergence.

Industrial MQTT architecture diagram showing edge gateways publishing data to a site broker, which connects through a secure DMZ to enterprise systems and applications.
Figure 6. Layered MQTT architecture across Purdue levels: gateways publish to a site broker, which bridges outbound through the DMZ; IT subscribes from the DMZ broker.

Security practices that hold up in audits:

  • Encrypt every connection with TLS, including inside the plant.
  • Give each device and application its own identity (certificate or credentials). Avoid shared accounts.
  • Restrict publish and subscribe rights by topic branch with access control lists (ACLs).
  • Keep command topics separate from data topics, and validate commands at the device.
  • Place brokers according to the Purdue model zones, and bridge outbound across the DMZ.
Common mistake Why it hurts Do this instead
Consumers subscribing to # They receive everything and break when others add topics Use the narrowest filter that works
QoS 2 everywhere More latency and broker state than the data needs Default to QoS 0 or 1
No Last Will or online marker Dashboards show stale values as if they were live Retained online status plus a Last Will
Treating the broker as a database Brokers route data; they do not keep history Persist to a historian or streaming platform

From MQTT to Sparkplug B

MQTT deliberately defines transport only. On a multi-vendor site, that leaves the topic structure, the payload format and device state open, and every consumer needs custom mapping. Sparkplug B, an open Eclipse Foundation specification also published as ISO/IEC 20237, fills these gaps on top of standard MQTT:

  • A fixed topic namespace: 0/<group_id>/<message_type>/<edge_node_id>/<device_id>
  • A compact, typed payload encoded with Protocol Buffers, with a name, data type, value and timestamp for every metric
  • Birth and death certificates, built on Last Will, so every consumer knows whether a device is online and its data current
  • Automatic tag discovery from birth messages
Plain MQTT MQTT with Sparkplug B
Topic structure Free-form, defined per project spBv1.0/group/type/node/device
Payload Undefined (JSON, text, binary) Protocol Buffers, typed metrics with timestamps
Device state Not defined Birth and death certificates
Multi-vendor interoperability Mapping per pair Any compliant client and host

Plain MQTT suits simple telemetry to IT or cloud consumers that expect readable JSON. Sparkplug B is the better choice when operations depend on interoperable, state-aware data from many vendors. The full explanation is in What Is Sparkplug B? Industrial MQTT Explained.

MQTT vs HTTP vs OPC UA

MQTT HTTP (REST) OPC UA
Pattern Publish/subscribe through a broker Request/response Client/server, plus PubSub
Data model None (Sparkplug B adds one) None (defined per API) Rich information models with browsing
Connection Persistent, outbound to the broker One request at a time Session per server
Strengths Low bandwidth, many-to-many, event-driven Universal tooling, large payloads Semantics, historical access, alarms and conditions, methods
Typical place Edge to site, site to enterprise and cloud IT systems and web APIs Control network: PLC, DCS, SCADA

Most brownfield plants use MQTT and OPC UA (OPC Unified Architecture) together: OPC UA close to the control system, MQTT for distribution. See MQTT vs OPC UA and combining OPC UA, MQTT and Sparkplug.

MQTT with SIOTH® and the MQTT Universal Broker

SIOTH® (Smart IoT Highway) is Integration Objects’ IT-OT-IIoT integration platform. It covers the full MQTT path in one platform: reading field protocols, publishing MQTT and Sparkplug B, brokering, adding asset context, and delivering data to SCADA, historians, analytics and cloud systems.

SIOTH® MQTT architecture showing Data Flow, the MQTT Universal Broker, Sparkplug B, and Data Model connecting industrial devices to SCADA, historians, analytics, and cloud applications.
Figure 7. MQTT on SIOTH®: Data Flow publishes MQTT and Sparkplug B and hosts the MQTT Universal Broker; Data Model adds ISA-95 context for consumers.

MQTT Universal Broker

The MQTT Universal Broker is a configurable server within SIOTH® Data Flow. It provides:

  • Eclipse Sparkplug B certified
  • MQTT Standard and Sparkplug B on the same broker
  • TCP and WebSocket endpoints
  • TLS/SSL encryption, basic authentication and Last Will and Testament

Publishing MQTT from the protocols you already run

SIOTH® Data Flow reads sources such as OPC UA, OPC Classic (DA, AE, HDA), Modbus TCP/RTU, DNP3, Siemens S7, Allen-Bradley ControlLogix and BACnet, and its MQTT connector publishes the data as MQTT Standard or Sparkplug B. Store-and-forward buffering covers intermittent links. Connectors can run on SIOTH® nodes close to the source, reading locally and forwarding to a SIOTH® master node.

Beyond the broker

SIOTH® module Role in an MQTT architecture
Data Flow Reads field protocols, publishes MQTT and Sparkplug B, and hosts the MQTT Universal Broker and the OPC UA Universal Server. Store-and-forward for unreliable links.
Data Model ISA-95 compatible asset model that gives MQTT data business context for a Unified Namespace.
Rule and Workflow Engine Runs expert rules, scripts and ML models on live MQTT data for alerts and decisions.
Unified HMI Web-based SCADA and dashboards on the same data, from any device.

Outbound, SIOTH® writes to historians (native connectors for AVEVA PI, AVEVA PI AF and InfluxDB), relational databases, Apache Kafka, Azure Event Hub and REST APIs. On security, SIOTH® applies a protocol break at the integration layer, supports DMZ deployments aligned with Purdue segmentation, encrypts data flows with TLS, enforces role-based access control (RBAC), and is ISA/IEC 62443 compliant.

Only need to stream one OPC DA server to MQTT? The standalone OPC Client for MQTT bridges OPC DA servers to MQTT brokers and cloud platforms, without the full platform.

Frequently asked questions

The server that receives every message and routes it to the clients subscribed to its topic. It also manages sessions, retained messages, Last Will messages and access control, which makes it the main point where security policy is enforced.

Start with QoS 0 or 1. Use QoS 0 for fast telemetry, QoS 1 for events and alarms, and QoS 2 only when duplicates cause harm and cannot be filtered out.

It can be. MQTT supports username and password authentication, and MQTT 5.0 adds enhanced authentication. Encryption comes from TLS, and topic-level authorization from the broker. Combine both with a unique identity per device and brokers placed correctly across the DMZ.

MQTT keeps a persistent connection and pushes data through a broker as soon as it changes, which suits constrained devices and unreliable networks. HTTP is request/response, better for large payloads and occasional exchanges.

Port 1883 for unencrypted TCP and port 8883 for MQTT over TLS. WebSocket connections use the port configured on the broker.

No. Plain MQTT with a well-kept topic convention works. Sparkplug B helps most when devices and applications from different vendors must interoperate without custom mapping, and when consumers must know whether data is current.

Not for hard, deterministic control loops, because messages pass through a broker over TCP. Use MQTT for monitoring, analytics and non-critical commands.

Yes. The MQTT Universal Broker is a configurable server within SIOTH® Data Flow. It supports MQTT Standard and Sparkplug B and is Eclipse Sparkplug B certified.

Run MQTT and Sparkplug B on SIOTH®
See Data Flow and the MQTT Universal Broker working with your own protocols and use case.
Request a Demo   ·   Download the Free Trial of SIOTH   ·   Explore the MQTT Universal Broker

 

Related Posts