MQTT is an IoT protocol based on the Pub/Sub model. With its characteristics of simple and easy implementation, support for QoS, and small packet.
The MQTT 5.0 protocol has made some upgrades for part of QoS packet, and the processes of dealing with packets, this article below display some simple introduction about the content of upgrades.
The message retention function of [EMQ X MQTT Broker](https://emqx.io) is implemented by the `emqx_retainer` plugin, which is enabled by default. By modifying the configuration of the` emqx_retainer` plugin, you can adjust the EMQ X Broker's retention message Location, restrict the number of retained messages and maximum payload length, and adjust the expiration time of retained messages.
When the simultaneously existing packets in the network link exceeds the limit, that is, the Inflight Window reaches its length limit of the (see `max_inflight`), the EMQ X broker will no longer send subsequent packets, but will store these packets in the Message Queue.
The publish-subscribe model is different from the traditional client-server model. It separates the client (publisher) that sends the message from the client (subscriber) that receives the message.
The MQTT protocol communicates by exchanging predefined MQTT control packets. We will take MQTTX as an example to show how to implement the publish and subscribe function through MQTT packets.
MQTT protocol transmits application messages over the network. When application messages are transmitted over MQTT, they have an associated quality of service (QoS) and topic (Topic). The topic is essentially a string, and the MQTT protocol specifies that the topic is a UTF-8 encoded string, which means that the comparison of the topic filter and the topic name can be done by comparing the encoded UTF-8 bytes or decoded Unicode characters
When the client disconnects, a will message is sent to the relevant subscriber.
Shared subscription is a new feature introduced by MQTT 5.0 protocol, which is equivalent to the load balancing function of subscribers.
MQTT protocol specifies the quality of service, which guarantees the reliability of message delivery under different network environments. The design of QoS is the focus of the MQTT protocol. As a protocol specifically designed for IoT scenarios, MQTT's operating scenarios are not only for PCs, but also in a wider range of narrow-bandwidth networks and low-power devices. If the problem of transmission quality can be solved at the protocol layer, it will provide great convenience for the development of Internet of things applications.