5 Things to Know About MQTT – The Protocol for Internet of Things
ragupta2 060000FKF2 Comments (2) Visits (55324)
The term Internet of Things (IoT) is used to describe the practice of connecting devices through the use of the Internet. The IoT is already connecting computing devices, appliances, humans and other living beings through the Internet. Accumulating data and knowledge through these Things would improve a vast array of items and experiences throughout the world. The IoT is made of events and signals of many different kinds and require a standardized mode of communication.
MQTT is described on the mqtt.org site as a machine-to-machine (M2M) / IoT connectivity protocol. This protocol is so lightweight that it can be supported by some of the smallest measuring and monitoring devices, and it can transmit data over far reaching, sometimes intermittent networks. MQTT is a publish/subscribe messaging transport protocol that is optimized to connect physical world devices and events with enterprise servers and other consumers. MQTT is designed to overcome the challenges of connecting the rapidly expanding physical world of sensors, actuators, phones, and tablets with established software processing technologies. These principles also turn out to make this protocol ideal for the emerging M2M or IoT world of connected devices where bandwidth and battery power are at a premium. The following are the five things to know about MQTT protocol.
1) MQTT publish subscribe architecture
The MQTT messages are delivered asynchronously (“push”) through publish subscribe architecture. The MQTT protocol works by exchanging a series of MQTT control packets in a defined way. Each control packet has a specific purpose and every bit in the packet is carefully crafted to reduce the data transmitted over the network. A MQTT topology has a MQTT server and a MQTT client. MQTT client and server communicate through different control packets. Table below briefly describes each of these control packets.
2) Ideal for constrained networks (low bandwidth, high latency, data limits, and fragile connections)
MQTT control packet headers are kept as small as possible. Each MQTT control packet consist of three parts, a fixed header, variable header and payload. Each MQTT control packet has a 2 byte Fixed header. Not all the control packet have the variable headers and payload. A variable header contains the packet identifier if used by the control packet. A payload up to 256 MB could be attached in the packets. Having a small header overhead makes this protocol appropriate for IoT by lowering the amount of data transmitted over constrained networks.
3) Quality of Service (QoS) for MQTT
Quality of service (QoS) levels determine how each MQTT message is delivered and must be specified for every message sent through MQTT. It is important to choose the proper QoS value for every message, because this value determines how the client and the server communicate to deliver the message. Three QoS for message delivery could be achieved using MQTT:
There is a simple rule when considering performance impact of QoS. It is “The higher the QoS, the lower the performance". MQTT provides flexibility to the IoT devices, to choose appropriate QoS they would need for their functional and environment requirements.
4) MQTT client abnormal disconnect notification
When a MQTT client connects to the MQTT server it can define a topic and a message that needs to be published automatically on that topic when it unexpectedly disconnects. This is also called the “Last will and testament” (LWT). When the client unexpectedly disconnects, the keep alive timer at the server side detects that the client has not sent any message or the keep alive PINGREQ. Hence the server immediately publishes the Will message on the Will topic specified by the client. The LWT feature can be useful in some scenarios. For example for a remote MQTT client, this feature can be used to detect when the IoT devices goes out of the network. The LWT feature can be used to create notifications for an application that is monitoring the client activity.
5) MQTT clients are very simple to implement
MQTT is open protocol and standardized by the OASI
The IBM MessageSight messaging appliance helps to deliver the performance, value, and simplicity that organizations need for accommodating this multitude of devices and processing large volumes of events in real-time. IBM MessageSight is built from the ground up with new technology to provide high scalability. IBM MessageSight extends existing messaging networks by adding the following characteristics:
In summary, MQTT is the protocol build for M2M and IoT which can help provide revolutionary new performance and opens up new areas for messaging use cases for billions of things connected through the Internet. The IBM Redbooks publication Buil