Basics What is MQTT and what is it used for?

Updated on 2023-08-30 Von Sebastian Human 4 min Reading Time

MQTT is an open network protocol for transmitting messages. It transfers important information in the Internet of Things. It is used especially when connections only allow a small amount of administrative data.

MQTT is designed for IoT devices and is lightweight, allowing for cost-effective device communication.(Image: freely licensed /  Pixabay)
MQTT is designed for IoT devices and is lightweight, allowing for cost-effective device communication.
(Image: freely licensed / Pixabay)

MQTT stands for Message Queuing Telemetry Transport. It is a lightweight communication protocol that was specifically developed for wireless sensor networks. As a result, it is frequently used in automation technology, industrial communication, and notably in the Internet of Things (IoT). Devices that were originally isolated can thus communicate directly with each other. MQTT is an open protocol that has been standardized by OASIS and the ISO (ISO/IEC 20922:2016).

It follows the principle of a Publish-Subscribe model and runs on TCP/IP. In this function, it allows a device to send information to a broker and then forward it to other devices that are interested in that information.

It is a simple yet powerful protocol. In its core function, it facilitates communication between different devices. Therefore, it plays an important role in machine-to-machine communication or the Internet of Things.

What does the MQTT architecture look like?

The MQTT architecture consists of a server, also known as a broker, one or more clients, and a network. The broker is the central intermediary that enables communication between the clients. It is responsible for receiving, storing, and sending messages to the clients.

The clients are the end devices that communicate with the broker. They can send messages to the broker and receive messages from the broker. Such a message is also called an MQTT message.

The network represents the connection between the broker and the clients. This can be either a local network or the internet. The so-called Quality of Service can be divided into three levels. This allows one to find the best individual compromise between the smallest possible data transmission and the greatest possible reliability for their own applications.

The Quality of Service starts at Level 0. This level only involves minimal data transfer. To keep the data volume as low as possible, this level focuses on delivering the message at most once. Confirmation of successful delivery is not provided at this level.

At Level 1, the broker attempts to successfully deliver the message and then waits for confirmation from the subscriber. If this confirmation is not received within a defined time period, the broker resends the information. This is why it is also referred to as at least once delivery.

At Level 2, the broker and client use a four-step handshake. Through this, both instances ensure that the message is sent or received exactly once. This is why it is referred to as exactly once delivery.

What does an MQTT broker do?

An MQTT broker is a server that acts as an intermediary between MQTT clients. It can also be referred to as an MQTT server. It receives messages from clients and forwards them to clients interested in those messages. The broker is responsible for managing messages and the connection between clients.

What role does an MQTT client play?

An MQTT client is a program that uses the protocol to transmit messages between a server and one or more clients. It can be used to transfer data between different devices. For example, it transmits information between a smartphone and a computer, or between a sensor and a server.

What tasks does MQTT perform?

This protocol is suitable for use in wireless sensor networks because it requires low bandwidth and energy consumption. MQTT is also used to counteract unreliable networks. It is considered very reliable and ensures secure information transmission. Additionally, it can be used as a communication protocol between various devices and systems. In this capacity, it transmits data between these entities.

What is MQTT-SN?

MQTT-SN provides a protocol alternative for devices that cannot be based on the TCP/IP protocol stack. This can include sensors and actuators. Initially, it was also referred to as MQTT-S. However, since this abbreviation led to misunderstandings, the decision was made to use the abbreviation MQTT-SN, with the additional SN standing for Sensor Networks.

Smaller message packets and connectionless communication via UDP (User Datagram Protocol) are thus possible. This allows reaching even computing-weak clients in the Internet of Things.

Subscribe to the newsletter now

Don't Miss out on Our Best Content

By clicking on „Subscribe to Newsletter“ I agree to the processing and use of my data according to the consent form (please expand for details) and accept the Terms of Use. For more information, please see our Privacy Policy. The consent declaration relates, among other things, to the sending of editorial newsletters by email and to data matching for marketing purposes with selected advertising partners (e.g., LinkedIn, Google, Meta)

Unfold for details of your consent

Who uses MQTT?

MQTT is primarily used by companies and organizations that require fast, reliable, and scalable communication between devices. Therefore, it is commonly used in the Internet of Things (IoT) to transfer data between devices. Naturally, it is also utilized in the automation industry, healthcare, transportation, retail, and other sectors.

How can one install an MQTT broker on a Raspberry Pi?

To install an MQTT broker on a Raspberry Pi, you first need to install the operating system on the single-board computer. Then, you need to open a terminal and enter the following commands:

  1. sudo apt-get update

  2. sudo apt-get install mosquitto

  3. sudo apt-get install mosquitto-clients

After that, the MQTT broker should be able to start with the command "mosquitto -v". It is also possible to edit the configuration file to customize the broker to individual requirements.

How secure is MQTT?

MQTT is considered a very secure protocol. It uses TLS encryption to encrypt all messages transmitted between the client and the broker. It also employs authentication and authorization to ensure that only authorized clients can access the broker. In addition, users can implement their own security measures, such as firewalls or VPNs, to further protect communication.

What is MQTT Standard 5.0?

MQTT Standard 5.0 is the latest version of the Message Queuing Telemetry Transport protocol. It was developed to enable secure and reliable communication between devices. This version offers a range of improvements over previous versions, including enhanced security features, expanded message control, and support for more message formats. These new features enable developers to create secure and reliable applications that are based on the MQTT protocol.