What is MQTT
MQTT used to stand for MQ Telemetry Transport, but is today referred to simply as MQTT and is no longer an acronym. It is an extremely simple and lightweight Publish/Subscribe messaging protocol invented at IBM and Arcom (now Eurotech) to connect restricted devices in low bandwidth, high-latency or unreliable networks.
If you're new to messaging protocols you might wonder what Publish/Subscribe is all about. Have a look at our Publish/Subscribe section to get a quick idea. If you'd like a refresher on message queues, please have a look at the Message Queue section.
Constrainted devices in unreliable networks
MQTT was originally designed to connect sensor nodes over communication networks that are unreliable or high-latency, or both.
As an example, MQTT has long been and still is used for monitoring oil and gas pipeline operations. Pipelines don't always run through areas with good connectivity, requiring a communication protocol that can cope with such an environment. Seensor nodes are often quite constrained in terms of resources and abilities, running on battery power and forced to limit energy consumption. They might also rely on satellite communication links with limited bandwidth and performance. MQTT was designed for such environments.
It's pretty clear today that MQTT is not limited to its original oil and gas use case, but has much broader applications in M2M, mobile and IoT verticals. Facebook uses MQTT in their Facebook Messenger. That seems very different to monitoring a pipeline first, but there are many similar technical constraints, like a mobile device with limited power and rapid network connectivity changes.
To choose the right messaging technology, it is critical to know in what kind of environment the devices will be running and what their communication patterns will look like.
If your project shares some similarities with the uses cases just mentioned, with a Publish/Subscribe messaging pattern, or just the need for a Message Queue, read on! There are good chances MQTT is the right tool for the job.
Everything you wanted to know about MQTT
The Publish/Subscribe pattern and Message Queueing both represent fundamental topics for any MQTT deployment and use case. MQTT is sometimes described as "just transport", but it's important to clarify that it's an application level protocol based on TCP/IP. Most brokers and client libraries only support the TCP/IP layer; although in theory MQTT could use different transport layers too.
The following sections give you the MQTT protocol basics. We deliberately limit technical depth and focus on use cases and choosing the right protocol. The most prominent features of MQTT you need to know are the following: