Overview of network and messaging protocols for IoT /OTUS blog. Online education /Habr
Russia's first online course IoT developer
starts at OTUS in October. Recruitment for the course is open right now, in connection with which we continue to share useful materials with you.
The Internet of Things (IoT, Internet of Things) will build on the existing network infrastructure, technologies and protocols currently used in homes /offices and the Internet, and will offer much more.
The purpose of this guide is to provide a brief overview of networking and application protocols for the IoT.
Note. You must have knowledge basics of network technologies
The IoT will work over existing TCP /IP networks.
TCP /IP uses a four-layer model with specific protocols at each layer. See understanding the TCP /IP 4 layer model (we deal with the four-tier TCP /IP model).
The diagram below shows a comparison of the protocols currently in use and those most likely to be used for IoT.
1. The font size indicates the popularity of the protocol. For example, on the left, IPv4 is larger as it is much more popular on the Internet today. However, it is smaller on the right as IPv6 is expected to be more popular in the IoT.
2. Not all protocols are shown.
3. Most of the changes are at the channel (levels 1 and 2) and application levels (level 4).
4. The network and transport layers are likely to remain unchanged.
Link layer protocols
At the Data Link level, you need to connect devices to each other. They can be located both close, for example, in local networks (local networks) and at a great distance from each other: in metropolitan area networks and global networks (wide area networks).
Currently, Ethernet and Wi-Fi are used at this level in home and office networks (LAN), and in mobile (WAN) networks - 3G /4G. However, many IoT devices are low power, such as sensors, and are powered only by batteries. Ethernet is not suitable in these cases, but low powered Wi-Fi and low powered Bluetooth can be used.
While existing wireless technologies (Wi-Fi, Bluetooth, 3G /4G) will continue to be used to connect these devices, it is also worth looking into new technologies specifically designed for IoT applications, which are likely to grow in popularity.
BLE - Bluetooth Low Energy
LoRaWAN - Long Range WAN
They are described in more detail in article An overview of IOT wireless technologies (overview of wireless IoT technologies).
At the network layer (Networking) in the long term, the protocol will dominate. IPv6
It is unlikely that IPv4 will be used, but it can play a role in the initial stages. Most IoT devices for the home, such as smart bulbs, currently use IPv4.
At the Transport layer, TCP dominates the Internet and the Web. It is used in both HTTP and many other popular Internet protocols (SMTP, POP? IMAP? etc.).
MQTT, which I expect will become one of the main application layer protocols for messaging, currently uses TCP.
However, in the future, due to lower overhead costs, I expect UDP to be more popular for the IoT. Probably, will be more widespread. MQTT-SN running on top of UDP. See comparison article TCP vs UDP
Application layer and messaging protocols
Important characteristics for IoT protocols:
Speed is the amount of data transferred per second.
Latency is the time it takes to send a message.
Availability of software tools.
Currently, two main protocols are actively used at this level: HTTP and MQTT.
HTTP is probably the most famous protocol of this layer, the underlying web (WWW). It will continue to be essential for the IoT as it is used for the REST API, the main mechanism for communication between web applications and services. However, due to high overhead costs, HTTP is unlikely to become the mainstream IoT protocol, although it will still be widely used on the Internet.
MQTT (Message Queuing Telemetry Transport) has become the main messaging protocol in the IoT due to its lightness and ease of use. See article 3-3-3147. Introduction to MQTT for beginners
(An introduction to MQTT for beginners).
Comparison of HTTP and MQTT for IoT
MQTT is fast becoming the de facto standard for IoT applications. This is due to its lightness and speed compared to HTTP and the fact that it is a one-to-many protocol rather than one-to-one (HTTP).
Many modern web applications would happily use MQTT instead of HTTP if available at the time of their development.
A good example is sending information to multiple clients, such as train /bus /plane arrivals and departures. In this scenario, a one-to-one protocol such as HTTP has a large overhead and places a heavy load on the web servers. Scaling these web servers can be difficult. With MQTT, clients connect to a broker that can be easily added for load balancing. Check out the video tutorial Republish HTML Data Over MQTT (Flight Arrivals Example) and article 3-3-3163. MQTT vs HTTP for IOT
Other messaging protocols
HTTP was not designed for IoT applications, but as mentioned, it will be widely used for some time due to its widespread use in API
Almost all IoT platforms support both HTTP and MQTT.
However, there are other protocols worth considering.
MQTT - (Message Queuing Telemetry Transport). Uses TCP /IP. The publisher-subscriber model requires a message broker.
AMQP - (Advanced Message Queuing Protocol). Uses TCP /IP. Publisher-Subscriber and Point-to-Point Models.
COAP - (Constrained Application Protocol). Uses UDP. Designed specifically for IoT, uses a request-response model like HTTP. RFC 7252
DDS - (Data Distribution Service)
In this article discusses the main protocols and their applications. The conclusion of this article is that the IoT will use a set of protocols depending on their intended use.
However, if you look back, in the early years of the Internet, the then dominant HTTP protocol was just one of a multitude of protocols.
Although HTTP was not originally conceived for file and email transfers, today it is used for both.
In the IoT, I expect the same thing to happen with messaging protocols: most services will use one dominant protocol.
Below are Google Trends charts showing how the popularity of MQTT, COAP and AMQP has changed over the past few years.
Google Trends Review
Support for protocols across platforms
Microsoft Azure - MQTT, AMQP, HTTP and HTTPS
AWS - MQTT, HTTPS, MQTT over websockets
IBM Bluemix - MQTT, HTTPS, MQTT
Thingworx - MQTT, HTTPS, MQTT, AMQP 3-3-3304.
Most of the changes are at the channel (levels 1 and 2) and application levels (level 4).
The network and transport layers are likely to remain unchanged.
At the application level, IoT components will use messaging protocols. While we are still in the early stages of IoT development, it is likely that one or possibly two messaging protocols will emerge.
Over the past few years, MQTT has become the most popular and that is what I am currently focusing on on this site.
HTTP will also continue to be used as it is already well built into existing IoT platforms.
That's all. We invite you to sign up for a free demo lesson on the topic "Chatbot for quick commands to the device"
Why unsecured consumer IoT systems are now a major business problem
It may be interesting