没有合适的资源?快使用搜索试试~ 我知道了~
MQTT 协议 5.0 中文版
需积分: 5 618 浏览量
2022-07-07
11:37:56
上传
评论 6
收藏 1.87MB PDF 举报
MQTT 协议 5.0 中文版
资源详情
资源评论
资源推荐

2017 年 10 月 26 日
MQTT v5.0 公开评审草案中文版 1/132
MQTT 协议 5.0 中文版
委员会规范草案 02 /
公开评审草案 02
2017 年 10 月 26 日
规范链接
当前版本:
http://docs.oasis-open.org/mqtt/mqtt/v5.0/csprd02/mqtt-v5.0-csprd02.docx (Authoritative)
http://docs.oasis-open.org/mqtt/mqtt/v5.0/csprd02/mqtt-v5.0-csprd02.html
http://docs.oasis-open.org/mqtt/mqtt/v5.0/csprd02/mqtt-v5.0-csprd02.pdf
以前的版本:
http://docs.oasis-open.org/mqtt/mqtt/v5.0/csprd01/mqtt-v5.0-csprd01.docx (Authoritative)
http://docs.oasis-open.org/mqtt/mqtt/v5.0/csprd01/mqtt-v5.0-csprd01.html
http://docs.oasis-open.org/mqtt/mqtt/v5.0/csprd01/mqtt-v5.0-csprd01.pdf
最新版本:
http://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.docx (Authoritative)
http://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html
http://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.pdf
技术委员会:
OASIS Message Queuing Telemetry Transport (MQTT) TC
主席:
Brian Raymor (brian.raymor@microsoft.com), Microsoft
Richard Coppen (coppen@uk.ibm.com), IBM
编辑:
Andrew Banks (andrew_banks@uk.ibm.com), IBM
Ed Briggs (edbriggs@microsoft.com), Microsoft
Ken Borgendale (kwb@us.ibm.com), IBM
Rahul Gupta (rahul.gupta@us.ibm.com), IBM
相关文档:
本规范代替:
• MQTT 协议 3.1.1 版本。编辑是 Andrew Banks 和 Rahul Gupta,发布于 2014 年 10 月 29 日,
OASIS 标准:http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html.
本规范与此有关:
• MQTT 和 NIST 网络安全框架 1.0 版。 编辑是 Geoff Brown 和 Louis-Philippe Lamoureux。最
新版本:http://docs.oasis-open.org/mqtt/mqtt-nist-cybersecurity/v1.0/mqtt-nist-cybersecurity-
v1.0.html.
摘要:
MQTT 是一个客户端服务端架构的发布/订阅模式的消息传输协议。它的设计思想是轻巧、开放、
简单、规范,因此易于实现。这些特点使得它对很多场景来说都是很好的选择,包括受限的环境如

2017 年 10 月 26 日
MQTT v5.0 公开评审草案中文版 2/132
机器与机器的通信(M2M)以及物联网环境(IoT),这些场景要求很小的代码封装或者网络带宽
非常昂贵。
本协议运行在 TCP/IP,或其他提供了有序、可靠、双向连接的网络连接上。它有以下特点:
• 使用发布/订阅消息模式,提供了一对多的消息分发和应用之间的解耦。
• 消息传输不需要知道负载内容。
• 提供三种等级的服务质量:
o “最多一次”,尽操作环境所能提供的最大努力分发消息。消息可能会丢失。例如,这个
等级可用于环境传感器数据,单次的数据丢失没关系,因为不久之后会再次发送。
o “至少一次”,保证消息可以到达,但是可能会重复。
o “仅一次”,保证消息只到达一次。例如,这个等级可用在一个计费系统中,这里如果消
息重复或丢失会导致不正确的收费。
• 很小的传输消耗和协议数据交换,最大限度减少网络流量。
• 异常连接断开发生时,能通知到相关各方。
状态:
本文档最后由 OASIS 成员在上面标示的日期最终修订或批准。批准的级别也在上面列出了。如果
要查看本文档最新的修订版请检查上面的
最新版本
位置。技术委员会产生的其他修订版和其他技
术文档都列在这里:https://www.oasis-
open.org/committees/tc_home.php?wg_abbrev=mqtt#technical .
技术委员会成员对本规范的评论应该发送到技术委员会的邮件列表。其他人应该发送评论到技术委
员会的公共评论列表,方法是点击技术委员会网站的发送评论按钮,网页地址是
https://www.oasis-open.org/committees/mqtt/ .
本规范草案的发布基于 OASIS 知识产权政策的 Non-Assertion 模式。关于实现本规范必不可少的
任何专利是否已公开,以及其他的专利许可条款相关的信息,请参考技术委员会网站的知识产权部
分 (https://www.oasis-open.org/committees/mqtt/ipr.php).
请注意,为本产品声明的任何机器可读内容(计算机语言定义)单独提供纯文本文件。对于产品叙
述文档中出现的任何不一致,以纯文本文档为准。
引用格式:
引用此规范时应该使用下面的引文格式:
[mqtt-v5.0]
MQTT Version 5.0. Edited by Andrew Banks, Ed Briggs, Ken Borgendale, and Rahul Gupta. 26
October 2017. OASIS Committee Specification Draft 02 / Public Review Draft 02.
http://docs.oasis-open.org/mqtt/mqtt/v5.0/csprd02/mqtt-v5.0-csprd02.html. Latest version:
http://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html
.

2017 年 10 月 26 日
MQTT v5.0 公开评审草案中文版 4/132
注意
Copyright © OASIS Open 2017. All Rights Reserved.
All capitalized terms in the following text have the meanings assigned to them in the OASIS Intellectual Property
Rights Policy (the "OASIS IPR Policy"). The full Policy may be found at the OASIS website.
This document and translations of it may be copied and furnished to others, and derivative works that comment on
or otherwise explain it or assist in its implementation may be prepared, copied, published, and distributed, in whole
or in part, without restriction of any kind, provided that the above copyright notice and this section are included on
all such copies and derivative works. However, this document itself may not be modified in any way, including by
removing the copyright notice or references to OASIS, except as needed for the purpose of developing any
document or deliverable produced by an OASIS Technical Committee (in which case the rules applicable to
copyrights, as set forth in the OASIS IPR Policy, must be followed) or as required to translate it into languages other
than English.
The limited permissions granted above are perpetual and will not be revoked by OASIS or its successors or assigns.
This document and the information contained herein is provided on an "AS IS" basis and OASIS DISCLAIMS ALL
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT
THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY
IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
OASIS requests that any OASIS Party or any other party that believes it has patent claims that would necessarily be
infringed by implementations of this OASIS Committee Specification or OASIS Standard, to notify OASIS TC
Administrator and provide an indication of its willingness to grant patent licenses to such patent claims in a manner
consistent with the IPR Mode of the OASIS Technical Committee that produced this specification.
OASIS invites any party to contact the OASIS TC Administrator if it is aware of a claim of ownership of any patent
claims that would necessarily be infringed by implementations of this specification by a patent holder that is not
willing to provide a license to such patent claims in a manner consistent with the IPR Mode of the OASIS Technical
Committee that produced this specification. OASIS may include such claims on its website, but disclaims any
obligation to do so.
OASIS takes no position regarding the validity or scope of any intellectual property or other rights that might be
claimed to pertain to the implementation or use of the technology described in this document or the extent to which
any license under such rights might or might not be available; neither does it represent that it has made any effort to
identify any such rights. Information on OASIS' procedures with respect to rights in any document or deliverable
produced by an OASIS Technical Committee can be found on the OASIS website. Copies of claims of rights made
available for publication and any assurances of licenses to be made available, or the result of an attempt made to
obtain a general license or permission for the use of such proprietary rights by implementers or users of this OASIS
Committee Specification or OASIS Standard, can be obtained from the OASIS TC Administrator. OASIS makes no
representation that any information or list of intellectual property rights will at any time be complete, or that any
claims in such list are, in fact, Essential Claims.
The name "OASIS" is a trademark of OASIS, the owner and developer of this specification, and should be used only
to refer to the organization and its official outputs. OASIS welcomes reference to, and implementation and use of,
specifications, while reserving the right to enforce its marks against misleading uses. Please see https://www.oasis-
open.org/policies-guidelines/trademark
for above guidance.

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
剩余131页未读,继续阅读









__Benco
- 粉丝: 37
- 资源: 10
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


会员权益专享
安全验证
文档复制为VIP权益,开通VIP直接复制

评论0