Hyper-text Transfer Protocol (HTTP) has always been the most popular communication tool between web clients and servers.
However, in the age of the Internet of things, the clients are no longer restricted to only web applications and browsers. Also, servers no longer simply reside as computers in the cloud. Managing connectivity of IoT objects requires a radically different approach.
Why HTTP Is Behind the Times
IoT clients and servers are now actual physical objects that need vital connectivity. They can range from an array of sensors to smart home gadgets and connected vehicles. In comparison, HTTP was designed for connectivity in a personal computing era. Times have changed.
The IoT era calls for a new connectivity protocol to ensure complete support for actual physical devices. To address this, Message Queuing Telemetry Transport (MQTT) is slowly gaining in popularity.
MQTT is a machine-to-machine protocol that is lightweight and uses a publish-and-subscribe model to reuse an established connection for as long as possible. This ensures greater reliability which is a prerequisite for smart home connections.
Amazon Web Services, Facebook Messenger and Microsoft Azure IoT Hub are already using MQTT to maintain always-on connectivity for their users.
There are many reasons why MQTT is an ideal choice for the high availability requirements of a smart home.
Minimum Data Consumption
Imagine moving to a new town (or country) but not having any connections to speak of. To find an apartment, you’ll likely seek a real estate broker’s help. Such a person not only has the property listings but also the necessary connections to reduce your waiting period.
What other option is there? You could go banging door to door to see if someone will rent you space. Although I don’t recommend it, this approach does work based on my own experiences.
Extending this analogy to a smart home, the MQTT protocol uses a “broker-like offering” to improve its connectivity provisioning. Various client devices will connect to a service using a broker server which greatly helps reduce data consumption. MQTT only uses a binary 2-bit header.
This is in sharp contrast to the HTTP model where the Web clients have no choice but to directly communicate with the server. If the server is down, you cannot see anything on your screen.
With MQTT protocol, even if a single server is down, it will find you another reliable server to get connectivity access. After all, that is what good “brokers” promise you.
MQTT has a slight edge over HTTP in regard to the security of the transmitted data. By default, it uses SSL/TLS as a message transmission pipe while encrypting the payload.
In contrast, HTTP does not offer any level of encryption, and the data is available in clear-text format. This makes the protocol penetrable by hackers. You need the additional provisioning of HTTPS for the first degree of encryption.
Ease of Use
MQTT is more relevant to home automation because it operates on a simple “command” and “outcome” approach. When you use an MQTT-based voice command to control a home appliance, you’re not bothered with establishing a connection first. You know the broker will do its job anyway.
As an end user, you are relieved of any stress of the system unexpectedly failing to perform to expectations. In MQTT parlance, this is what is known as a “publish and subscribe system.”
Only with HTTP systems, you’ll have to get accustomed to client or server side failures and try to figure out how to fix the problems on your own.
There is a reason many smart devices available online are increasingly offering MQTT support. It’s versatile, tamper-proof and even someone who never used IoT products before can work with them easily. Compare that to the time it took you to learn the Internet.
What are your thoughts about MQTT? Do let us know in the comments.