2017 年 10 月 26 日
MQTT v5.0 公开评审草案中文版 5/132
目录
1 概述 ................................................................................................................................................................... 12
1.0 知识产权政策 .................................................................................................................................................. 12
1.1 MQTT 协议的组织结构 .................................................................................................................................. 12
1.2 术语 .................................................................................................................................................................. 12
1.3 规范引用 .......................................................................................................................................................... 14
1.4 非规范引用 ...................................................................................................................................................... 14
1.5 数据表示 .......................................................................................................................................................... 17
1.5.1 二进制位 .................................................................................................................................................. 17
1.5.2 双字节整数 .............................................................................................................................................. 17
1.5.3 四字节整数 .............................................................................................................................................. 17
1.5.4 UTF-8 编码字符串 ................................................................................................................................. 17
1.5.5 变长字节整数 .......................................................................................................................................... 19
1.5.6 二进制数据 .............................................................................................................................................. 20
1.5.7 UTF-8 字符串对...................................................................................................................................... 20
1.6 安全 .................................................................................................................................................................. 20
1.7 编辑约定 .......................................................................................................................................................... 20
1.8 变更历史 .......................................................................................................................................................... 20
1.8.1 MQTT v3.1.1 .......................................................................................................................................... 20
1.8.2 MQTT v5.0 .............................................................................................................................................. 20
2 MQTT 控制报文格式........................................................................................................................................ 22
2.1 MQTT 控制报文结构 ...................................................................................................................................... 22
2.1.1 固定报头 .................................................................................................................................................. 22
2.1.2 MQTT 控制报文的类型 .......................................................................................................................... 22
2.1.3 标志 .......................................................................................................................................................... 23
2.1.4 剩余长度 .................................................................................................................................................. 24
2.2 可变报头 .......................................................................................................................................................... 24
2.2.1 报文标识符 .............................................................................................................................................. 24
2.2.2 属性 .......................................................................................................................................................... 26
2.2.2.1 属性长度 ........................................................................................................................................................... 26
2.2.2.2 属性 ................................................................................................................................................................... 26
2.3 有效载荷 .......................................................................................................................................................... 27
2.4 原因码 .............................................................................................................................................................. 28
3 MQTT 控制报文 ............................................................................................................................................... 31
3.1 CONNECT – 连接请求 .................................................................................................................................. 31
3.1.1 CONNECT 固定报头 ............................................................................................................................. 31
3.1.2 CONNECT 可变报头 ............................................................................................................................. 31
3.1.2.1 协议名 ............................................................................................................................................................... 31
3.1.2.2 协议版本 ........................................................................................................................................................... 32
3.1.2.3 连接标志 ........................................................................................................................................................... 32
评论1