Introduction
IoT works on Machine to Machine communication. The information is mostly sensor based real time information. Message size being very small requires a protocol that does not consume a large part of the bandwidth. This is exactly what MQTT protocol is all about.
MQTT is an acronym for (Message Queuing Telemetry Transport). It was invented by Dr. Andy Stanford-Clark of IBM in 1999 and it gained popularity with IoT network. MQTT is an extremely lightweight protocol, consumes very less power and can be used for networks with high latency or networks that are very unreliable too.
MQTT in Detail
MQTT protocol uses subscribe/publish messaging pattern. Picture this, a whole network of entities connected to one another could consume a whole lot of bandwidth and overhead, if continuous sessions were to be retained, using a protocol like say HTTP.
With MQTT ’s subscribe and publish pattern, sensor information is published on to a “Message Broker”. A message broker is an intermediary program that translates the sender’s information into a form that can be understood by the receiver. Once the information is published the information will be broadcasted to all the entities who have subscribed to this information in the IoT network.
If Subscriber 1 has subscribed for information on topic: temp and Subscriber 2 for sensor information on topic: Humidity, then once the topic: temp and topic: humidity information is published by the temperature sensor and the humidity sensor to the message broker, the message broker broadcasts the topic temp to Subscriber 1 and topic: Humidity to Subscriber 2.
In case the network is poor for any subscriber then the information on temperature, humidity or any other requested parameter would be cached and sent to the subscriber once the network connection is re-established.
Such is the power of MQTT protocol. If you like this article, please like, comment or share and we’ll send you more of such insightful articles.