MQTT --- Retained Message
保留消息定义
如果PUBLISH消息的RETAIN标记位被设置为1,则称该消息为“保留消息”;
Broker会存储每个Topic的最后一条保留消息及其Qos,当订阅该Topic的客户端上线后,Broker需要将该消息投递给它。
A retained message is a normal MQTT message with the retained flag set to true. The broker will store the last retained message and the corresponding QoS for that topic Each client that subscribes to a topic pattern, which matches the topic of the retained message, will receive the message immediately after subscribing. For each topic only one retained message will be stored by the broker.
保留消息作用
可以让新订阅的客户端得到发布方的最新的状态值,而不必要等待发送。
A retained message makes sense, when newly connected subscribers should receive messages immediately and shouldn’t have to wait until a publishing client sends the next message. This is extremely helpful when for status updates of components or devices on individual topics. For example the status of device1 is on the topic myhome/devices/device1/status, a new subscriber to the topic will get the status (online/offline) of the device immediately after subscribing when retained messages are used. The same is true for clients, which send data in intervals, temperature, GPS coordinates and other data. Without retained messages new subscribers are kept in the dark between publish intervals. So using retained messages helps to provide the last good value to a connecting client immediately.
保留消息的删除
- 方式1:发送空消息体的保留消息;
- 方式2:发送最新的保留消息覆盖之前的(推荐);
MQTT --- Retained Message的更多相关文章
- EMQ学习笔记---Clean Session和Retained Message
MQTT会话(Clean Session)MQTT客户端向服务器发起CONNECT请求时,可以通过’Clean Session’标志设置会话.‘Clean Session’设置为0,表示创建一个持久会 ...
- MQTT 单个订阅消息量过大处理
The missing piece between MQTT and a SQL database in a M2M landscape Message Queue Telemetry Transpo ...
- Tsung MQTT协议简介及MQTT xml文档配置介绍
MQTT协议简介及MQTT xml文档配置介绍 by:授客 QQ:1033553122 1. MQTT协议介绍 MQTT(Message Queuing Telemetry Transport,消息队 ...
- MQTT 3.1.1,值得升级的6个新特性
前言 以前看英文文章或资料,看完之后,摘要或者忘记.这一次选择感兴趣的MQTT 3.1.1介绍文章资料,引文见文末,作为练手:非完全翻译,去除掉一些广告性描述,若侵权,请告知. 在沉寂了四年之后,QT ...
- Android Apollo MQTT入门
一.Apache Apollo服务器其实是一个消息中转站 下载地址 http://activemq.apache.org/apollo/download.html 服务搭建方式,参看博客Android ...
- mqtt使用二(集成到java代码中)
1.我采用的是springboot,首先pom文件中添加mqtt需要用到的依赖 <dependency> <groupId>org.springframework.boot&l ...
- 物联网架构成长之路(32)-SpringBoot集成MQTT客户端
一.前言 这里虽然是说MQTT客户端.其实对于服务器来说,这里的一个具有超级权限的MQTT客户端,就可以做很多事情.比如手机APP或者网页或者第三方服务需要发送数据到设备,但是这些又不是设备,又不能让 ...
- MQTT协议及EMQ应用
MQTT是基于TCP/IP协议栈构建的异步通信消息协议,是一种轻量级的发布/订阅信息传输协议.MQTT在时间和空间上,将消息发送者与接受者分离,可以在不可靠的网络环境中进行扩展.适用于设备硬件存储空间 ...
- spring boot 集成mqtt
1.pom文件中添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifact ...
随机推荐
- 函数使用十一:BAPI_BANK_CREATE
FI01创建银行主数据: BAPI:BAPI_BANK_CREATE *&----------------------------------------------------------- ...
- Linux进程管理之top
关于Linux进程查看,前面讲解了ps命令,下面拉介绍另一个命令top ps:静态查看 top:动态查看 动态查看进程的状态 # top [root@wei ~]# top top - 18:38:4 ...
- centos7.2下安装python3.6.5
yum groupinstall 'Development Tools' 出现错误 系统 centos 7.3 使用命令 yum groupinstall 'Development Tools' 出现 ...
- 第一部分day03-元组、字典、字符串
-----元组-----元组查询 a = (1,2,3,4) print(a[1:2]) #(2,) 购物车练习(列表方法练习) product_list=[ ['Mac',9000], ['kind ...
- Iconfont技术
什么是 IconFont 顾名思义,IconFont 就是字体图标.严格地说,就是一种字体,但是,它们不包含字母或数字,而是包含符号和字形.您可以使用 CSS 设置样式,就像设置常规文本一样,这使得 ...
- Django常用自段和参数
本文目录 1 ORM字段 2 ORM字段参数 3 关系字段 4 多对多关联关系的三种方式 5 元信息 6 自定义字段(了解) 回到目录 1 ORM字段 AutoField int自增列,必须填入参数 ...
- windows 上robot framework 读取sqlite3提示:OperationalError: unable to open database file错误
原因:路径写的不正确. 正确的写法:'D:/Python27/163/demo.db' 或者 r 'E:\\rf-demos-master\\DatabaseDemo\\demo.db' Connec ...
- wordpress后台添加左侧边栏菜单如何操作
我们有时为了方便操作会把一些特定的链接添加到wordpress后台左侧菜单栏中,这个要如何实现呢?其实不会很难,使用两个WordPress内置函数就可以解决问题,分别是add_menu_page()和 ...
- wordpress调用自定义post_type文章
前面我们讲了wordpress添加post_type自定义文章类型,我们现在来讲一下如何把自定义文章调用出来,我们以product为例,虽然我们自定义好了 Post Type 同时也编写了一些内容,但 ...
- win +R
一.电脑设置免登录密码及修改密码 1.win+R 2.输入control userpasswords2 3.勾选免密码账号登陆,修改密码 二.打开性能监视器 1.win+R 2.输入perfmon.e ...