Internet of Things Communication Protocol-MQTT

Posted in 知识科普  |  Tagged , , ,

summarize

IoT applications vary widely and protocols are diverse, and among the manyIoT communication protocolsMQTT was supposedly designed specifically for the Internet of Things, although it wasn't called that at the time. The officialMQTT3.1.1 specificationDescription: "MQTT is a client-server publish/subscribe messaging transport protocol. It is lightweight, open, simple, and designed to be easy to implement. These characteristics make it ideal for use in many situations, including constrained environments such as machine-to-machine (M2M) andInternet of Things (IoT)(IoT) environments where the need for a smaller code footprint and/or network bandwidth is invaluable. Its features include:

  • - Use the publish/subscribe messaging pattern, which provides one-to-many message distribution and decoupling of applications.
  • - Load-content-independent message-passing transport.
  • - Three qualities of service for message delivery: 0 (at most once), 1 (at least once), 2 (exactly once)
  • - Transmission overhead is low and protocol switching is minimized to reduce network traffic.
  • - A mechanism for notifying interested parties in the event of an abnormal disconnection.

Development History

1999IBMThe company's Andy Stanford-Clark and Arcom (now theCirrus link) of Arlen Nipper, to solve the problem of connecting and communicating between satellites and oil pipelines, they invented and designed a protocol to achieve minimal battery loss and minimal bandwidth transmission, with several explicit requirements for the protocol:

  • Simple and easy to implement
  • Reliable transmission quality of service data
  • Lightweight and high bandwidth efficiency
  • Data agnostic
  • persistent session awareness

In 2010, after ten years of internal discussions, IBM officially released the free version of MQTT3.1 to the public, welcoming everyone to implement and use this protocol.

2013.OASISSuch an open standardization organization officially announced its standardization efforts for MQTT. After a year of continuous efforts by the standardization team, on October 29, 2014, MQTT became an officially approved OASIS release.

In March 2019, OASIS approved the new MQTT 5 specification, which introduces new features needed for IoT programs deployed on cloud platforms, as well as the need for higher reliability and low error rate messaging.

The "MQ" in MQTT refers to the MQ series of products developed by IBM to support teleportation, which means that MQ is just a logo and does not have any meaning in it, and it is incorrect to label MQTT as a message queue protocol in many articles. A clear example of this is that with message queue protocol a message is only used by one client, whereas with MQTT every subscriber receives the message.

MQTT's publish/subscribe model

MQTT发布/订阅架构

The publish/subscribe model separates the client that sends the message (the publisher) from the client that receives the message (the subscriber). The connection between them is handled by a third component (proxy). Such a specification solves the problems of space, time and synchronization.

  • Space: publisher and subscriber don't need to know about each other and don't need to exchange IP addresses and ports
  • Time: Publishers and subscribers don't need to work at the same time
  • Synchronization: no interruption of any operation of publishing and receiving devices, either in publishing or in receiving devices

The publish/subscribe model removes direct communication between message publishers and recipients/subscribers, allowing clients and servers to scale better and be highly parallelized, and message caching and intelligent routing of messages improves scalable IoT architecture. Which client/subscriber receives which message can be controlled through the filtering activity of the MQTT server proxy, which has the following 3 options:

Topic-based filtering: the client subscribes based on topics, which have a hierarchical structure and allow a limited number of expressions for filtering

Content-based filtering: the receiving client can subscribe to messages of interest, but the problem is that the content of the message needs to be known in advance and cannot be encrypted

Type-based filtering: filtering based on the type/class of the message message (event event)

MQTT's three service levels

QoS (Quality of Service) is an important MQTT metric, an agreement between message senders and message receivers that defines delivery guarantees for specific messages

QoS 0 Once at most

Messages are delivered on a best-effort basis depending on the operating environment. However, there is no guarantee that the receiver will receive the data, and it is possible that a message may be lost, where the loss of a single read does not matter because the next read will be released shortly. A service level of 0 is often referred to as "ready-to-go".

QoS 0

QoS 1 At least once

QoS level 1 guarantees that a message is delivered to the receiver at least once. The sender stores the message until it receives a PUBACK packet from the receiver acknowledging receipt of the message. Messages can be sent or delivered multiple times

QoS 1

QoS 0 exactly once

QoS 2 is the highest level of service in MQTT. This level guarantees that each message will be received by the recipient only once.QoS 2 is the safest and slowest quality of service level. The guarantee is provided by at least two request/response flows (four handshakes) between the sender and the receiver. The sender and receiver use the packet identifier of the original published message to coordinate the delivery of the message.

QoS 2

resource link

MQTT.org website

MQTT specification

OASIS MQTT Technical Committee

EMQ XEMQ X Cloud is a free online MQTT 5 server provided by EMQ X Cloud. In order to optimize the access speed of domestic users, two access points are provided, one overseas and one domestic, with EMQ X deployed in AWS USA and EMQ X (domestic) deployed in Tencent Cloud's Shanghai region, so that there is a stable network channel for domestic access.

Eclipse : Free online MQTT server available

Mosquitto free online MQTT server provided by the community.

HiveMQ: Founded in 2012, the company is headquartered in Landshut, Germany, in the wine center of Munich. Flagship product HiveMQ is an MQTT-based messaging platform designed to enable fast, efficient and reliable two-way data movement between devices and the cloud

Cirrus Link's :The Cirrus Link solution is based on the efficient, open-standard MQTT protocol co-created by CTO Arlen Nipper.

MQTT use cases in various industries

Editor-in-chief of the website.

Content review.
en_USEnglish