Why MQTT is not enough

As part of the development team working on the Lucid protocol (previously known as WITS-IoT), Mark Davison often answers questions relating to how Lucid relates to its underlying protocol of MQTT. Also, we hear people saying that they use or intend to use MQTT as their protocol, but not explaining what they intend to use alongside MQTT to give their data meaning, as if MQTT was, in its own right, enough. This article explains why it is not enough to just say you are “using MQTT”.

Why is MQTT not enough?

MQTT is defined as “a Client Server publish/subscribe messaging transport protocol” within its specification and as “a lightweight publish-subscribe network protocol that transports messages between devices” on its Wikipedia page. The common and important words here are message and transport. ‘messages’ being the bits of information that are sent over MQTT and ‘transport’ being the process of setting up and sending those messages i.e. MQTT.

So, MQTT is the method by which communications can be set up and messages are conveyed. However, MQTT makes no assertions about what messages are carried or their content; this is left to some other protocol to define.

It is similar to a phone call, in which one uses the phone to set up a call, but the phone system (transport) over which your speech (message) is sent does not care what you say or indeed in what language you say it.  MQTT also operates in this way; it provides a way of connecting and talking from one device to another, but does not impose any restrictions or rules on what is being said.

Phone Analogy. Messages and transport
The similarities between messages and transport in the phone system and MQTT

Normally when two computers talk together there exists a detailed description of what they may say and how they may respond. This “protocol” for talking allows the device at one end to understand what the device at the other end wants. MQTT provides none of this and instead only provides the transport over which such a protocol can pass.

This is why it is not enough to say “let’s use MQTT” and leave it at that, since you know only how the message will travel, but not what the message will say. Instead, you should be saying something like “let’s use MQTT with some other protocol”, where that protocol defines what information is conveyed in the conversation between endpoints.

What protocols can be used with MQTT?

The protocol you could use with MQTT, to define what is said in the conversation, depends upon what you wish to achieve with that conversation. In essence, this protocol provides the meaning to a conversation that is happening over MQTT. The sending end knows how to present the data in the message it sends, and the receiving end knows how to interpret the data from the message it receives. That presentation and interpretation is the protocol in this instance.

Within the IoT and telemetry area, protocols such as Sparkplug B, OPC-UA and Lucid could provide the description of the messages and responses that are sent. These protocols speak to a specific business domain and present the language of that domain over the underlying transport, in this case MQTT. Other domains and protocols exist for other business areas.

More widely, the protocols used alongside MQTT can vary from simple to complicated. For example, if a simple device was sending its temperature every minute, it may be enough to agree that the messages sent over MQTT contain a textual representation of a number, such as “21”, where that number represents the temperature in degrees Celsius. Conversely, in more complicated protocols such as Lucid, features of MQTT such as topics, are used to convey the action or type of data that is being sent.

A takeaway

If you hear people talking about using MQTT then you now know that some other protocol, however simple, is needed to define what data is being carried over MQTT and how it is to be interpreted. So, in order to understand what is going on under the hood, you will always need to know what is being said over the MQTT transport; in other words, what protocol is being used with MQTT.

MQTT on its own is not enough!

Article by Mark Davison.


Please see our Lucid reading page for a collated list of other articles and information on Lucid.