​

## 1. Retained Messages

​        Unlike ordinary messages, retained messages can be stored on the MQTT server. Any new subscriber that subscribes to a topic matching the retained message's topic immediately receives that message, even if the message was published before they subscribed to the topic.

​       This allows subscribers to get data updates immediately after coming online, without waiting for the publisher to publish the message again. To some extent, we can use retained messages as a message "cache": upload messages to the "cache" at any time, and fetch messages from the "cache" at any moment. Of course, this "cache" also has the limitation that only the latest retained message can be stored under a topic.

### Retained Message List

> Topic
>
> QoS (Quality of Service)
>
> Client Id
>
> Publish Time
>
> Retained
>
> Operation

<img src="../../../../cluster/v2/images/shared/retail.png" style="border:1px solid #ccc;border-radius:6px;margin:8px 0;" loading="lazy" alt="Retained message list page screenshot" />

### Retained Message Details

Supports `plainText`, `Json`, and `Hex` parsing.

<img src="../../../../cluster/v2/images/shared/retain-detail.png" style="border:1px solid #ccc;border-radius:6px;margin:8px 0;" loading="lazy" alt="Retained message details page screenshot" />

### Retained Message Demo

> Create a new client, edit a retained message, check the retained message option, and send the message.
>
> The message sent here is a retained message and is recorded in memory.

<img src="../../../../cluster/v2/images/retain/retain-001.png" style="border:1px solid #ccc;border-radius:6px;margin:8px 0;" loading="lazy" alt="Retained message demo page screenshot" />

> You can also view the delayed message records in the platform, as shown below.

<img src="../../../../cluster/v2/images/retain/retain-002.png" style="border:1px solid #ccc;border-radius:6px;margin:8px 0;" loading="lazy" alt="Retained message demo page screenshot" />

> Create a new client, bring the client online, and subscribe to the retained message topic; you can see the retained message is delivered successfully.

<img src="../../../../cluster/v2/images/retain/retain-003.png" style="border:1px solid #ccc;border-radius:6px;margin:8px 0;" loading="lazy" alt="Retained message demo page screenshot" />
