IOT devices need to communicate with the cloud periodically. This communication involves both sending data to cloud (such as sensor data) and receiving data (such as receiving commands) from cloud.
IOT devices are connected to multiple devices / applications through the cloud i.e. Data sent by one IOT device can be used by another IOT device & can be monitored by a web or mobile application simultaneously. Thus it is important to have “one to many” communication is IOT systems.
One of the protocol which satisfies the above requirement is MQTT. MQTT is a publish-subscribe-based “lightweight” messaging protocol above TCP/IP protocol. MQTT has a central server to which multiple clients connect. All the incoming/outgoing messages to the server are identified using message topics. Any of the connected clients can publish and subscribe to any topics.
For example, one IOT sensor device can publish a sensor data using a specific topic & another IOT device / applications can receive the sensor data by subscribing to the same topic. The delivery of the published messages to subscribed clients will be handled by the MQTT server.
Generally, IOT devices will not require high data bandwidths. Time between two successive communication packets in IOT devices can vary between minimum of hundreds of milli-seconds to maximum of several minutes. This bodes well with the MQTT which supports only low throughput data bandwidth.
Below are few other features of the MQTT which suits the IOT environment –
- MQTT protocol adds minimum headers to the payload data, thus reducing the network bandwidth usage.
- Due to simple architecture of the MQTT protocol, code footprint to implement MQTT client will be smaller which suits the general micro controller environments of IOT devices.
- MQTT protocol supports different QoS (Quality of Service) levels for message delivery, making it useful for IOT devices which are deployed in limited network coverage area.
- Ease of MQTT protocol implementation with growing community support
With the above benefits, MQTT is emerging as the most commonly used protocol in IOT industry.