MQTT messaging middleware characteristics

MQTT as a messaging middleware is based publish / subscribe (publish / subscribe) mode "lightweight" communication protocol built on TCP / IP protocol.
MQTT biggest advantage is that the code may be minimal and limited bandwidth for real-time remote devices to provide reliable messaging service. As a low-cost, low bandwidth usage of instant messaging protocol, so there is more widely used in things, small equipment, mobile applications. MQTT communication protocol operating at the remote sensors and control devices low bandwidth, unreliable network protocol design, which has the following main characteristics of several

(1) using the publish / subscribe messaging model, providing many message distribution decouples applications.

(2) load the contents of message transmission mask.

(3) using the TCP / IP provides a network connection.

 主流的MQTT是基于TCP连接进行数据推送的,但是同样有基于UDP的版本,叫做MQTT-SN。这两种版本由于基于不同的连接方式,优缺点自然也就各有不同了。

(4) There are three Quality of Service news release:

"At most once", the news release completely dependent on the underlying TCP / IP network. Occur missing or duplicate messages. This level can be used in the following cases, the environmental sensor data, loss of a read record does not matter, because there will be sent a second time soon after. This is a way to push major general of APP, if your smart device is offline when the message push, push past did not receive, will not receive the network again.

"At least once" to ensure that the message reaches, but the message is repeated may occur.

"Only once" to ensure that the message reaches once. In some of the more stringent requirements of the billing system, you can use this level. In the billing system, the message is repeated or missing will lead to incorrect results. This news release highest quality service can also be used to push APP instant communications, ensuring that users receive and will receive only once.

(5) a small transmission overhead is small (fixed-length header is 2 bytes), a protocol exchange minimized to reduce network traffic.

This is why it is very suitable for presentation in the "Internet of things in the field of communications, information-collecting sensor with the server," to know that computing power and bandwidth of embedded devices is relatively weak, the use of this protocol to deliver the message again for enough.

(6) using the Last Will and Testament characteristics to inform interested parties mechanisms client aborted.

Last Will: That is testament mechanism for other devices to send the last words of the same subject under the notification device has been disconnected.

Testament: the mechanism will function similar to the Last Will.

Guess you like

Origin blog.51cto.com/chenhva/2476082