With the Internet of Things constantly growing and gaining popularity, new protocols are being introduced to make development and implementation easier. Zunch Labs is dedicated to staying up to date with all of the latest IoT developments, including MQTT‘s introduction to the IoT.
MQTT was first developed in 1999 for monitoring of an oil pipeline that ran through the desert. The goal of this was to have a bandwidth-efficient protocol that uses as little battery power as possible. This is because the devices were connected by satellite, making it very expensive at the time.
MQTT protocol uses a publish/subscribe architecture instead of the typical HTTP request/response paradigm. Publish/Subscribe is an event driven architecture that allows messages to be pushed to clients, with the central communication point being the MQTT broker which includes a topic into the message. Each client that wants to receive messages subscribes to a certain topic, and then the broker will deliver all the messages with a matching topic to the client. With this said, the clients don’t have to know one another, they only need to communicate over the topic. This process and architecture allows for incredibly scalable solutions with the regular dependencies between data, consumers, and producers.
This is in contrast to HTTP where a client will pull the information it needs. Instead, the broker pushes the information to the client when there is something new and has a permanently open TCP connection. In the event that this connection is interrupted, the broker will buffer the messages and wait for a stable connection to send them to the client.
The uses for this in the IoT can be described by how MQTT dispatches messages as topics. A topic is a string that can have more hierarchy levels which are separated by slashes. For example, if you were building a smart home with MQTT, the hierarchy for sending and receiving data to the living room could look something like this.