MQTT

Message Queuing Telemetry Transport

MQTT is a the leading TCP/IP machine-to-machine/IoT communication protocol for Industry 4.0 that provides data exchange within a network of devices. It is a lightweight, open source publish/subscribe communication model with a fast response time. Getting up and running with MQTT is quick and easy. It is a good choice for small-sized devices with low power consumption. Its minimum overhead ensures smooth data transfer with low bandwidth.

Need help? Let us help you.

Publish/subscribe communication method

Thanks to the lightweight Publish/subscribe method MQTT is interesting for use in mobile applications, where energy-efficient and reliable data transfer is key. Publish/subscribe is an alternative to the traditional HTTP client-server model, where the client communicates directly with the endpoint.

The difference is that in the publish/subscribe model, the client does not extract data from the server, but he receives the messages relevant to the topic he’s subscribed to from the server. A reliable TCP connection is required for communication. If this is interrupted, the server can store the data in a data buffer and send it to clients when the connection is re-established.

Want to purchase our equipment?

Event driven data transfer

The central communication point is the so-called MQTT broker, which communicates with the clients (publishers and subscribers) via an internet connection or a local network. A publisher creates messages and publishes them to a certain topic.

The data transfer is event-driven, which means that data is transmitted when change occurs (or at time intervals). A subscriber receives the messages relevant to the topic it is subscribed to.

As a standard practice, topics should follow a hierarchy which allows for logical grouping/arrangement for a network of sensors.

MQTT

Meet the advantages of MQTT

MQTT architecture

MQTT provides a high level of security. Although it uses the TCP protocol, data can be encrypted using the TLS/SSL cryptographic protocols. Partial or complete encryption is available – selected depending on the characteristics of the application and the system performance.

The control packets are very small, each consisting of a fixed header (2–5 bytes), a variable header and a payload. Downloading only the essential components reduces the amount of data, and at the same time, each packet does not necessarily contain a variable header and a payload. Thus, MQTT protocol is suitable in cases of low transfer speed, high response time, transfer limit and unstable connection.

Messages are sent asynchronously (“push”) using the pub/sub architecture. Each packet sent has its own purpose, each bit is carefully created so that data consumption is kept to a minimum.

Each MQTT network consists of at least:

  • 1 x MQTT broker,
  • 1 x MQTT publisher,
  • 1 x MQTT subscriber.

When a client connects to a broker, it defines the address and message that must be published if the connection is terminated unexpectedly (“Last will and testament-LWM” concept). If the client loses the connection, the keep alive timer determines that the client did not send a message or PINREQ. The broker then immediately publishes the LWM message.

MQTT is an open, OASIS Technical Committee standardized protocol that enables integration into IoT, platforms, and operating systems. For most MQTT applications, the implementation of basic commands (CONNECT, PUBLISH, SUBSCRIBE, DISCONNECT) is sufficient. Many libraries are also available through the Eclipse Paho project.

The QoS level must be determined for each sent message, because it determines how the server and the client communicate. There is a simple rule, the higher the QoS, the lower the efficiency. Three levels are distinguished:

  • QoS 0 – A publisher sends a message without requesting guaranteed delivery. Data loss may occur.
  • QoS 1 – A publisher sends a message until it gets a delivery confirmation. Duplicates may occur.
  • QoS 2 – A publisher sends a message only once with guaranteed delivery.

Read the latest Networking news

Subscribe to our newsletter!

    Contact form 7 Mailchimp extension by Renzo Johnson - Web Developer