MQTT Essentials - All Core Concepts Explained (2024)

The Ultimate Guide to MQTT for Beginners and Experts

MQTT (Message Queuing Telemetry Transport) is the de facto data exchange protocol for IoT messaging. Standardized by OASIS and ISO, the MQTT publish/subscribe protocol provides a scalable and reliable way to connect devices over the Internet.

MQTT is the most commonly used messaging protocol for the Internet of Things (IoT). MQTT stands for MQ Telemetry Transport. The protocol is a set of rules that defines how IoT devices can publish and subscribe to data over the Internet. MQTT is used for messaging and data exchange between IoT and industrial IoT (IIoT) devices, such as embedded devices, sensors, industrial PLCs, etc. The protocol is event driven and connects devices using the publish /subscribe (Pub/Sub) pattern. The sender (Publisher) and the receiver (Subscriber) communicate via Topics and are decoupled from each other. The connection between them is handled by the MQTT broker. The MQTT broker filters all incoming messages and distributes them correctly to the Subscribers.

HiveMQ wrote the book on MQTT

You’re in the right place for expert guidance and resources whether you’re new to MQTT or building out your IoT platform.

Get the New MQTT Essentials

MQTT 5 MQTT Sparkplug MQTT Security MQTT Client Library

What is MQTT?

The MQTT protocol is the de-facto standard for IoT messaging. Standardized by OASIS and ISO, MQTT publish/subscribe protocol provides a scalable and reliable way to connect devices over the Internet. Today, MQTT is used by many companies to connect millions of devices to the Internet.

Why Companies Use MQTT

  • It requires minimal resources since it is lightweight and efficient

  • Supports bi-directional messaging between device and cloud

  • Can scale to millions of connected devices

  • Supports reliable message delivery through 3 QoS levels

  • Works well over unreliable networks

  • Security enabled, so it works with TLS and common authentication protocols

Key Features

MQTT Essentials - All Core Concepts Explained (1)

MQTT Clients

MQTT clients publish a message to an MQTT broker and other MQTT clients subscribe to messages they want to receive. Implementations of MQTT clients typically require a minimal footprint so are well suited for deployment on small constrained devices and are very efficient in their bandwidth requirements.
HiveMQ developed a Java-based MQTT client that is available under an open source license.

MQTT Essentials - All Core Concepts Explained (2)

MQTT Broker

MQTT brokers receive published messages and dispatch the message to the subscribing MQTT clients. An MQTT message contains a message topic that MQTT clients subscribe to and MQTT brokers use these subscription lists for determining the MQTT clients to receive the message.
HiveMQ offers a commercial and open source MQTT broker.

MQTT Essentials - All Core Concepts Explained (3)

MQTT QoS (Quality of Service) Levels

MQTT implements 3 quality of service levels for agreement between the sender and receiver:

1) At most once (0),

2) At least once (1), and

3) Exactly once (2).

These QoS levels allow for more reliable IoT applications since the underlying messaging infrastructure and adapt to unreliable network conditions.

MQTT Essentials - All Core Concepts Explained (4)

Persistent Sessions

MQTT allows for a persistent session between the client and the broker. This allows for sessions to persist even if the network is disconnected. Once the network is reconnected, the information to reconnect the client to the broker still exists. This is one of the key features that makes the MQTT protocol more efficient than HTTP for use over unreliable cellular networks.

MQTT Essentials - All Core Concepts Explained (5)

Retained Messages

MQTT clients that subscribe to a new topic have no insight into when to expect the first message they will receive. However, an MQTT broker can store a retained message that can be sent immediately upon a new MQTT subscription. In this case, the MQTT client will receive at least one message upon subscribing to the topic.

MQTT Essentials - All Core Concepts Explained (6)

Last Will and Testament (LWT)

An MQTT client can specify to an MQTT broker a message, called the last will, that will be sent if the MQTT client ungracefully disconnects. This allows for a more graceful system wide notification that a client has been disconnected.

MQTT Basics: What is MQTT and How Does it Work?

Chapters
  • 00:00 - Introduction
  • 00:26 - What does the acronym MQTT stand for?
  • 01:07 - What does MQTT do?
  • 02:13 - Publish-Subscribe Pattern
  • 02:50 - MQTT Architecture
  • 04:50 - MQTT enables IoT
  • 05:50 - Conclusion

MQTT Basics

MQTT is the most commonly used messaging protocol for the Internet of Things (IoT). MQTT stands for MQ Telemetry Transport. The protocol is a set of rules that defines how IoT devices can publish and subscribe to data over the Internet. MQTT is used for messaging and data exchange between IoT and industrial IoT (IIoT) devices, such as embedded devices, sensors, industrial PLCs, etc. The protocol is event driven and connects devices using the publish / subscribe (Pub/Sub) pattern. The sender (Publisher) and the receiver (Subscriber) communicate via Topics and are decoupled from each other. The connection between them is handled by the MQTT broker. The MQTT broker filters all incoming messages and distributes them correctly to the Subscribers.

MQTT Tutorial: An Easy Guide to Getting Started with MQTT MQTT Tutorial Introducing the MQTT Protocol MQTT Essentials Part 1 MQTT Publish/Subscribe Architecture (Pub/Sub) MQTT Essentials Part 2 MQTT Client, MQTT Broker, and MQTT Server Connection Establishment Explained MQTT Essentials Part 3

MQTT Features

MQTT is packed with features, such as Quality of Service (QoS) levels, persistent session and queuing messages, Retained Messages, etc.

Quality of Service Levels MQTT Essentials - Part 6 Persistent Session and Queuing Messages MQTT Essentials - Part 7 Retained Messages MQTT Essentials - Part 8 Last Will and Testament MQTT Essentials - Part 9

MQTT vs. Other IoT Protocols

Which protocol is the right choice for your IoT requirements? Check out these valuable resources.

MQTT vs. HTTP: Which protocol is the best for IoT or IIoT? MQTT Essentials MQTT vs. AMQP for IoT MQTT Essentials Understanding the Differences between MQTT and WebSockets for IoT MQTT Essentials MQTT vs. ZeroMQ for IoT MQTT Essentials MQTT vs. CoAP for IoT MQTT Essentials Modbus TCP vs. MQTT MQTT Essentials

More on MQTT

Learn more about MQTT and MQTT brokers.

MQTT Packets: A Comprehensive Guide Explore MQTT control packets, the core of IoT communication. Learn their structure and types to design and test MQTT-based systems. MQTT Broker Comparison – Which is the Best for Your IoT Application? In-depth comparison of open-source Vs. commercial Vs. cloud MQTT brokers for IoT/IIoT devices and applications. Creating Highly Available and Ultra-scalable MQTT Clusters Learn how MQTT Broker Clusters are essential for high availability and scalability to solve the critical part of a messaging infrastructure. MQTT over Websockets Learn to send and receive MQTT messages directly in a browser. Implementing MQTT in Java Learn how to set up an MQTT client and a broker connection in Java. Implementing MQTT in JavaScript Learn how to set up an MQTT client and a broker connection in JavaScript. Implementing MQTT in C Learn how to set up an MQTT client and a broker connection in C. Implementing MQTT in C Sharp Learn how to set up an MQTT client and a broker connection in C Sharp. Implementing MQTT in Python Learn how to set up an MQTT client and a broker connection in Python. 15 Frequently Asked MQTT Questions Top 15 frequently asked questions or FAQs about MQTT protocol, such as does MQTT work with Apache Kafka, does MQTT require internet, etc.

Celebrate 25 Years of MQTT with HiveMQ

Join us as we celebrate 25 years of MQTT. Enroll into our mailing list and we'll keep you updated on all of the happenings this year from MQTT awards to a fireside chat later in the year.

Join Us Learn More

MQTT Resources

MQTT.org Website

OASIS MQTT Technical Committee

MQTT Essentials MQTT 5 Essentials MQTT FAQ MQTT Security Fundamentals

MQTT Glossary

Get to Know the Key MQTT Terminologies at a Glance

Apply for the MQTT Innovation Awards

The MQTT Innovation Awards recognize the outstanding achievements of leading companies and individuals leveraging the HiveMQ platform and MQTT technology across diverse industries including energy, automotive, manufacturing, transportation, logistics, and beyond.

Learn More Apply Now

Case Studies

MQTT Essentials - All Core Concepts Explained (7) BMW Share Now uses HiveMQ for reliable message connectivity for their car sharing application.

MQTT Essentials - All Core Concepts Explained (8) Mercedes-Benz uses HiveMQ to ensure quality production across 24 global factories.

MQTT Essentials - All Core Concepts Explained (9) Discover how Liberty Global is building their new digital media platform.

MQTT Essentials - All Core Concepts Explained (10) Matternet uses HiveMQ for real-time communication with medical transport drones.

Get the help you need.

Ask our experts or learn more about MQTT as you work to connect, communicate, and control your IoT data.

Ask our Experts MQTT Essentials

MQTT Essentials - All Core Concepts Explained (2024)
Top Articles
Latest Posts
Recommended Articles
Article information

Author: Mr. See Jast

Last Updated:

Views: 6386

Rating: 4.4 / 5 (75 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Mr. See Jast

Birthday: 1999-07-30

Address: 8409 Megan Mountain, New Mathew, MT 44997-8193

Phone: +5023589614038

Job: Chief Executive

Hobby: Leather crafting, Flag Football, Candle making, Flying, Poi, Gunsmithing, Swimming

Introduction: My name is Mr. See Jast, I am a open, jolly, gorgeous, courageous, inexpensive, friendly, homely person who loves writing and wants to share my knowledge and understanding with you.