Internet of Things (IoT) is gaining more traction with the arrival of connected device such as the Raspberry Pi, Arduino and other embedded platform. While working on these platforms, the question that strikes the mind is what is the best messaging protocol to use on these IoT devices?

MQTT Protocol

MQ Telemetry Transport (MQTT) is a lightweight publish/subscribe messaging protocol. It is used to connect various IoT devices with enterprise servers and consumers.

MQTT uses TCP (Transmission Control protocol), and has features beneficial to IoT devices. Moreover, it is well-established and there are numerous client and server implementations, making it easier to develop.

As mentioned earlier, MQTT works on publish/subscribe architecture which pushes new information from servers as soon as they are updated. MQTT is an open and standardized protocol which makes it easy to adopt for the wide variety of IoT devices, platforms, and operating systems.

HTTP/2 Protocol

HTTP/2 protocol is the latest update to the previous HTTP protocol by the Internet Engineering Task Force (IETF). It is the successor to HTTP/1.1, and is a much-awaited refresh, as the web has changed over the years. This latest update brings with it improvements in efficiency, speed and security.

HTTP/2 protocol allows multiple requests at the same time, on the same connection. HTTP/1.1 protocol doesn’t allow multiple requests at the same time as a result of which each transfer would have to wait for other transfers to complete. HTTP/2 is easier, more compact and less error-prone. Moreover, it uses HPACK compressions to reduce overhead.

Conclusion

Currently for most IoT devices and applications, MQTT is the best protocol. MQTT is the most widely adopted protocol and newer solutions like Websockets support MQTT. With it, your device can communicate seamlessly with other IoT devices. HTTP/2 on the other hand can be used to communicate with devices that are in close proximity.