MQTT (Message Queue Telemetry Transmission) is built based on the TCP/IP protocol stack and has become the standard for IoT communication

Internet of Things (IoT) devices must be connected to the Internet. By connecting to the Internet, devices can collaborate with each other and work with back-end services. The basic network protocol of the Internet is TCP/IP. MQTT (Message Queue Telemetry Transmission) is based on the TCP/IP protocol stack and has become the standard for IoT communication.
Insert picture description here

MQTT (Message Queuing Telemetry Transport) is an instant messaging protocol developed by IBM. It is a lightweight, proxy-based "publish/subscribe" message transmission protocol. It has the advantages of concise protocol, compactness, strong extensibility, energy saving, power saving, etc., and there are already multiple language versions such as PHP, JAVA, Python, C, C#, Go, etc., which can basically be used on any platform, almost It connects all networked items with the outside, so it is particularly suitable for use as a communication protocol for the Internet of Things.

Compared with the HTTP protocol, it is not suitable for large-scale IoT applications. This is because:
Insert picture description here

1. HTTP is a synchronization protocol. The client needs to wait for the server to respond, and it depends on the higher network signal quality.

2. HTTP is one-way. The client must initiate a connection. In IoT applications, devices or sensors are usually clients, which means they cannot passively receive commands from the network.

3. HTTP is a 1-1 protocol. The client makes a request and the server responds. Sending messages to all devices on the network is not only difficult, but also expensive, and this is a common use case in IoT applications.

4. HTTP is a heavyweight protocol with many headers and rules. It is not suitable for restricted networks.
Features of
MQTT The MQTT protocol is a protocol designed for communication between a large number of remote sensors and control devices that have limited computing power and work on a low-bandwidth, unreliable network. It has the following main features:

  1. Using the publish/subscribe message model, one publisher can correspond to multiple subscribers. When the publisher changes, he can notify all subscribers one by one. This mode provides greater network scalability and a more dynamic network topology. Because MQTT messages are organized by topic, application developers can flexibly specify that certain clients can only interact with certain messages.
    After understanding the basics of MQTT and combining with a simple architecture, here is a simple example diagram to understand the communication model of the MQTT protocol more intuitively. MQTT Broker chose EMQ as a demonstration. For example, if there is a temperature sensor (1 Machine), a mobile device, a computer, and a server (3 Machines), you can get or display the temperature value of the temperature sensor. You need to subscribe (subscribe) through the MQTT protocol. For example, the topic called temperature is as follows:
    Insert picture description here

In the picture, mobile devices, servers, and computers need to subscribe a topic called temperature through EMQ. When the temperature sensor publishes temperature data, the three devices can receive it.
2. Message transmission that shields the content of the load;
3. Uses TCP/IP to provide network connection;
4. There are three types of message publishing service quality:
 "At most once", message publishing is completely dependent on the underlying TCP/IP network. Message loss or duplication can occur. This level can be used in the following situations, the environmental sensor data, it does not matter if you lose a reading record, because there will be a second transmission soon. This method is mainly for general APP push. If your smart device is not connected to the Internet when the message is pushed, and the push has not been received in the past, it will not be received again when it is connected to the Internet.
 "At least once" to ensure that the message arrives, but message duplication may occur. This level can be used in the following situations, you need to get every message, and the repeated sending of messages has no impact on your usage scenarios.
 "Only once" to ensure that the message arrives once. In some billing systems with strict requirements, this level can be used. In the billing system, duplicate or missing messages can lead to incorrect results. This highest-quality message publishing service can also be used to push instant messaging apps to ensure that users receive it and only receive it once.
5. Small transmission, low overhead (fixed-length header is 2 bytes), protocol exchange is minimized to reduce network traffic. It has a simple header to specify the message type, a text-based subject, and an arbitrary binary payload. The application can use any data format for the payload, such as JSON, XML, encrypted binary or Base64, as long as the target client can parse the payload;
6. Use the Last Will and Testament features to notify the relevant parties of the mechanism of abnormal client interruption.
As an IoT company focusing on eSIM technology, Miracle IoT has released AM20E, AM21E, AM400E and other NB/LTE modules, which support multiple communication protocols including MQTT protocol. Customers can use eSIM modules to connect IoT terminal devices. Deployed on a private server, it can also be deployed on public cloud platforms such as Alibaba Cloud and OneNET. Our company provides rich product development materials and program routines to help users implement projects quickly.

Insert picture description here

Insert picture description here

Guess you like