MQTT basics

The MQTT message protocol stands for MessageQueuingTelemetryTransportand was invented in 1999 for machine-to-machine communication by IBM employee Andy Stanford-Clark and former Acron employee Arlen Nipper. It was originally developed for monitoring an oil pipeline, which placed special demands on the protocol.

The protocol is suitable for machine-to-machine communication or for Internet of Things applications, as it is designed to send small messages to the largest possible number of devices in a very short time. MQTT enables reliable and efficient communication between a very large number of devices.

MQTT has been officially considered an Internet of Things protocol since 2013 and is specified by the OASIS(Organizationfor the Advancementof StructuredInformationStandards). In 2016, version 3.1.1 was certified as an ISO standard (ISO/IEC 20922:16). Version 5.0 was published in 2019.

Physics / Topology

In general, MQTT works according to the client-server principle. The server represents the so-called MQTT broker, which is responsible for message management, message distribution and storage. In MQTT, the clients are referred to as publishers and subscribers. The messages are either sent or received by the clients. The publishers take on the task of publishing and actively send messages to the broker. Subscribers, on the other hand, subscribe to certain information and receive the data relevant to them from the broker. This means that senders and receivers are independent of each other and cannot communicate directly with each other, so there is no end-to-end connection.

The message format in MQTT is structured in so-called topics.
The principle of these topics is structured as follows, for example: House/Floor/Room/Temperature.
This allows subscribers to subscribe to different variants of these topics in order to receive the required data from the MQTT broker. For this purpose, data from houses, floors and rooms can be subscribed to the broker individually or by inserting a wildcard "#".
MQTT uses TCP as the transport protocol for this data transfer. Ports 1883 and 8883 have been reserved for MQTT by the IANA(InternetAssignedNumbersAuthority).

In the event of a connection failure, it is possible to specify in advance whether and how data transmission should be continued after recovery. In this scenario, you can choose between three types of Quality of Service (QoS0, QoS1, QoS2). QoS0 stands for at-most-once delivery and is used when only a low transmission guarantee is required. Although an attempt is made to deliver the message, it either reaches the recipient once or not at all. QoS1, on the other hand, stands for at-least-once delivery. Here a confirmation from the recipient is expected; if this is not received, the message is resent. QoS2, Exactly-once Delivery, guarantees the transmission of a message exactly once.

Cybersecurity

MQTT only uses the option of authenticating the clients through the server as basic authentication. This mechanism works with password authentication and uses a user name and password for this. For this purpose, the required data is transmitted via a user name flag and a password flag and the values are set to 1. This password authentication can also be used to transfer a token, for example.
One form of extended authentication is the use of TLS certificates, which also enables the client to authenticate the server. In general, when using TLS, TCP port 8883 should be selected, which has the IANA service name Secure-MQTT and has been specially assigned for such applications.

TLS not only offers the option of authentication via certificates, but can also encrypt the transmitted data. To increase data protection, the internal memory should be encrypted by server and client-side implementations to prevent external attacks.

In summary, the TLS transport protocol has authentication, integrity and data protection; many important security aspects.

The SimpleAuthenticationand SecurityLayer(SASL) mechanism offers an alternative authentication method to TLS. This is a method that supports connection-based protocols for identifying and authenticating clients to a server.

Furthermore, virtual network connections can be realized via VirtualPrivateNetwork(VPN). VPN has integrated security controls, which ensures secure data exchange between the communication partners.

Variants / Versions


MQTT-SN (formerly MQTT-S) is a similar but limited variant of MQTT based on the observer pattern and was developed specifically for sensor networks. The requirement for this variant was an extremely low transmission rate and protection against transmission errors.

MQTT v3.1 was the first version with OASIS standard and ISO/IEC 20922:2016 (2016).

MQTT v5.0 is the current version of the protocol and is specified as an OASIS standard (2018).

 

Further information:

Our MQTT portfolio:

Remote maintenance

Modular remote maintenance and M2M router Ewon Flexy for remote maintenance and data services

To the products

HMI and IIoT edge Gateways

The smart HMIs of the cMT series - Server / Client HMI architecture - High flexibility and strong improvement in work efficiency.

To the products

Gateways

Connection to an MQTT broker (server) possible
TLS / SSL encryption possible
A wide range of bus protocols possible

To the products

IIoT platform

Collect & evaluate machine data centrally from almost any IIoT device using MQTT in the hardware-independent IIoT platform from VISUALYS.

More information