The most used protocols in IoT

Undoubtedly the two most used protocols in the IoT world are HTTP and MQTT, each with its characteristics, advantages and disadvantages. Both protocols are available for use through libraries in all the languages used for the development of IoT devices.

In the following sections I describe the characteristics of each of them and at the end a comparison between them.

NOTE: If you need help to communicate your device with the WiFi network, this may help you Article.


HTTP is the historical protocol used to transfer data on the World Wide Web and therefore it is natural that it is also used for IoT applications. Its mode of operation is of the type request/response – client/server.

IoT management platforms that use it have an HTTP-based application interface (API). This interface is called the RESTful API (REST for Representational State Transfer).

A RESTful interface uses the familiar HTTP methods: GET to get data, PUT to send data (object, file, or block), POST to create a resource, and DELETE to delete it.

HTTP in its versions 1 and 2 uses the TCP transport protocol, while version 3 supports the use of UDP. In general, it is recommended to use TCP to guarantee the delivery of messages, although in very reliable and robust networks it can be an advantage to use UDP to establish shorter and faster communications. The latter has a positive impact not only on the use of the network, but also on the energy consumption of the IoT nodes, especially those that are powered by batteries. However, most platforms use versions 1 and 2.

One of the benefits of using HTTP is its ability to send or receive large amounts of data efficiently. If the IoT node or gateway sends images, video streams, or files, we recommend using HTTP.

To provide security, HTTPS and TLS can be used to encrypt the data transfer. 


MQTT was born as a communication protocol between machines (M2M – machine to machine), so it has features designed exclusively for this type of application. Its mode of operation is through publication/subscription to a topic, in which you publish or read.

By the way, here's a Article on how to install an MQTT server on a Raspberry Pi. And in this one other I explain how to add encryption.

Their messages are short, so the data transmissions are also short, and this impacts the power consumption of the nodes, something crucial in battery-powered devices.

MQTT only allows communication through TCP and has three modes of operation in terms of message delivery (QoS – quality of service):

  • At most once: This is a best effort policy, message delivery is not guaranteed.
  • At least once: Delivery is guaranteed, but the same message can be delivered more than once.
  • Exactly once: Each message is guaranteed to be received only once by the recipient.

 MQTT allows identification by user and password or token and encryption using SSL/TLS. Would you like to install your own MQTT server for free on a cloud server? Here I leave you a video-tutorial and a $100 credit to use on Digital Ocean. 


The choice of one of these two protocols for the communication of the devices will depend on several factors

  • The type of information to send. For small messages MQTT is better, while for data blocks HTTP is better.
  • MQTT is recommended on battery powered nodes as it improves power usage.
  • For communication between devices it is always convenient to use MQTT, in fact that is what the protocol was originally intended for.
  • HTTP is useful in gateways to transfer all the information at once, instead of sending many messages.
  • MQTT can adapt to unreliable networks by configuring QoS quality of service.

If you liked this article and found it useful, I would appreciate it if you commented or shared it on your networks.


Jose Luis Fernandez · 6 July, 2019 at 8:20 PM

It was useful to me and it is clear

    IoT Consulting · 8 July, 2019 at 2:25 PM

    Thank you very much jose. Cheers!

Miguel A. Calveiro · 11 November, 2020 at 11:42 AM

Thank you very much. Very concise conclusions.

    IoT Consulting · 11 November, 2020 at 12:26 PM

    Thank you very much Michael. I am happy that is was useful for you.


How to install an MQTT server on Raspberry Pi - IoT Consulting · 25 March, 2020 at 10:28 AM

[…] stop looking at this article, where I talk about the differences between MQTT and HTTP and what is the best option in each case. And yes […]

How to install your own MQTT server in the cloud - Your IoT expert source · 19 July, 2020 at 10:28 AM

[…] you still don't know what protocol to use in your IoT project, here is an article where I talk about the differences between HTTP and […]

How to Manage IoT Devices Safely - Your IoT Expert Source · 9 February, 2021 at 10:29 AM

[…] MQTT vs HTTP – What to choose for your IoT project […]

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: