没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
This document was last revised or approved by the membership of OASIS on the above date. The level of approval is also listed above. Check the “Latest version” location noted above for possible later revisions of this document.
资源推荐
资源详情
资源评论
mqtt-v5.0-csprd02 26 October 2017
Standards Track Work Product Copyright © OASIS Open 2017. All Rights Reserved. Page 1 of 149
MQTT Version 5.0
Committee Specification Draft 0102 /
Public Review Draft 0102
13 July26 October 2017
Specification URIs
This version:
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
Previous version:
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
Previous version:
N/A
Latest version:
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
Technical Committee:
OASIS Message Queuing Telemetry Transport (MQTT) TC
Chairs:
Brian Raymor (brian.raymor@microsoft.com), Microsoft
Richard Coppen (coppen@uk.ibm.com), IBM
Editors:
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
Related work:
This specification replaces or supersedes:
• MQTT Version 3.1.1. Edited by Andrew Banks and Rahul Gupta. 29 October 2014. OASIS
Standard. http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html.
This specification is related to:
• MQTT and the NIST Cybersecurity Framework Version 1.0. Edited by Geoff Brown and
Louis-Philippe Lamoureux. Latest version: http://docs.oasis-open.org/mqtt/mqtt-nist-
cybersecurity/v1.0/mqtt-nist-cybersecurity-v1.0.html.
Abstract:
MQTT is a Client Server publish/subscribe messaging transport protocol. It is light weight, open,
simple, and designed to be easy to implement. These characteristics make it ideal for use in
many situations, including constrained environments such as for communication in Machine to
mqtt-v5.0-csprd02 26 October 2017
Standards Track Work Product Copyright © OASIS Open 2017. All Rights Reserved. Page 2 of 149
Machine (M2M) and Internet of Things (IoT) contexts where a small code footprint is required
and/or network bandwidth is at a premium.
The protocol runs over TCP/IP, or over other network protocols that provide ordered, lossless, bi-
directional connections. Its features include:
• Use of the publish/subscribe message pattern which provides one-to-many message
distribution and decoupling of applications.
• A messaging transport that is agnostic to the content of the payload.
• Three qualities of service for message delivery:
o "At most once", where messages are delivered according to the best efforts of the
operating environment. Message loss can occur. This level could be used, for
example, with ambient sensor data where it does not matter if an individual reading is
lost as the next one will be published soon after.
o "At least once", where messages are assured to arrive but duplicates can occur.
o "Exactly once", where messages are assured to arrive exactly once. This level could
be used, for example, with billing systems where duplicate or lost messages could
lead to incorrect charges being applied.
• A small transport overhead and protocol exchanges minimized to reduce network traffic.
• A mechanism to notify interested parties when an abnormal disconnection occurs.
Status:
This document was last revised or approved by the OASIS Message Queuing Telemetry
Transport (MQTT) TC on the above date. The level of approval is also listed above. Check the
“Latest version” location noted above for possible later revisions of this document. Any other
numbered Versions and other technical work produced by the Technical Committee (TC) are
listed at https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=mqtt#technical.
TC members should send comments on this specification to the TC’s email list. Others should
send comments to the TC’s public comment list, after subscribing to it by following the
instructions at the “Send A Comment” button on the TC’s web page at https://www.oasis-
open.org/committees/mqtt/.
This Committee Specification Public Review Draft is provided under the Non-Assertion Mode of
the OASIS IPR Policy, the mode chosen when the Technical Committee was established. For
information on whether any patents have been disclosed that may be essential to implementing
this specification, and any offers of patent licensing terms, please refer to the Intellectual Property
Rights section of the TC’s web page (https://www.oasis-open.org/committees/mqtt/ipr.php).
Note that any machine-readable content (Computer Language Definitions(aka Computer
Language Definitions)) declared Normative for this Work Product is provided in separate plain
text files. In the event of a discrepancy between any such plain text file and display content in the
Work Product's prose narrative document(s), the content in the separate plain text file prevails.
Citation format:
When referencing this specification the following citation format should be used:
[mqtt-v5.0]
MQTT Version 5.0. Edited by Andrew Banks, Ed Briggs, Ken Borgendale, and Rahul Gupta. 13
July26 October 2017. OASIS Committee Specification Draft 0102 / Public Review Draft 0102.
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.
mqtt-v5.0-csprd02 26 October 2017
Standards Track Work Product Copyright © OASIS Open 2017. All Rights Reserved. Page 3 of 149
Notices
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.
mqtt-v5.0-csprd02 26 October 2017
Standards Track Work Product Copyright © OASIS Open 2017. All Rights Reserved. Page 4 of 149
Table of Contents
1 Introduction ......................................................................................................................................... 11
1.0 IPR Policy ......................................................................................................................................... 11
1.1 Organization of the MQTT specification ........................................................................................... 11
1.2 Terminology ...................................................................................................................................... 11
1.3 Normative references ....................................................................................................................... 13
1.4 Non-normative references ................................................................................................................ 13
1.5 Data representation .......................................................................................................................... 16
1.5.1 Bits ............................................................................................................................................. 16
1.5.2 Two Byte Integer ....................................................................................................................... 16
1.5.3 Four Byte Integer ....................................................................................................................... 16
1.5.4 UTF-8 Encoded String ............................................................................................................... 16
1.5.5 Variable Byte Integer ................................................................................................................. 18
1.5.6 Binary Data ................................................................................................................................ 19
1.5.7 UTF-8 String Pair ...................................................................................................................... 19
1.6 Security ............................................................................................................................................. 19
1.7 Editing convention ............................................................................................................................ 19
1.8 Change history .................................................................................................................................. 20
1.8.1 MQTT v3.1.1.............................................................................................................................. 20
1.8.2 MQTT v5.0 ................................................................................................................................. 20
2 MQTT Control Packet format ............................................................................................................. 21
2.1 Structure of an MQTT Control Packet .............................................................................................. 21
2.1.1 Fixed Header ............................................................................................................................. 21
2.1.2 MQTT Control Packet type ........................................................................................................ 21
2.1.3 Flags .......................................................................................................................................... 22
2.1.4 Remaining Length ..................................................................................................................... 23
2.2 Variable Header ................................................................................................................................ 23
2.2.1 Packet Identifier ......................................................................................................................... 23
2.2.2 Properties .................................................................................................................................. 25
2.2.2.1 Property Length ................................................................................................................................. 25
2.2.2.2 Property ............................................................................................................................................. 25
2.3 Payload ............................................................................................................................................. 27
2.4 Reason Code .................................................................................................................................... 27
3 MQTT Control Packets ....................................................................................................................... 30
3.1 CONNECT – Connection Request ................................................................................................... 30
3.1.1 CONNECT Fixed Header .......................................................................................................... 30
3.1.2 CONNECT Variable Header ...................................................................................................... 30
3.1.2.1 Protocol Name ................................................................................................................................... 30
3.1.2.2 Protocol Version................................................................................................................................. 31
3.1.2.3 Connect Flags .................................................................................................................................... 31
3.1.2.4 Clean Start ......................................................................................................................................... 32
3.1.2.5 Will Flag ............................................................................................................................................. 32
3.1.2.6 Will QoS ............................................................................................................................................. 33
3.1.2.7 Will Retain .......................................................................................................................................... 33
3.1.2.8 User Name Flag ................................................................................................................................. 33
mqtt-v5.0-csprd02 26 October 2017
Standards Track Work Product Copyright © OASIS Open 2017. All Rights Reserved. Page 5 of 149
3.1.2.9 Password Flag ................................................................................................................................... 33
3.1.2.10 Keep Alive ........................................................................................................................................ 34
3.1.2.11 CONNECT Properties ...................................................................................................................... 35
Property Length ........................................................................................................................ 35
Session Expiry Interval ............................................................................................................. 35
Receive Maximum .................................................................................................................... 36
Maximum Packet Size .............................................................................................................. 37
Topic Alias Maximum ............................................................................................................... 37
Request Response Information ................................................................................................ 38
Request Problem Information ................................................................................................... 38
User Property ........................................................................................................................... 38
Authentication Method.............................................................................................................. 39
Authentication Data ................................................................................................................ 39
3.1.2.12 Variable Header non-normative example ......................................................................................... 39
3.1.3 CONNECT Payload ................................................................................................................... 40
3.1.3.1 Client Identifier (ClientID) ................................................................................................................... 40
3.1.3.2 Will Properties .................................................................................................................................... 41
Property Length .......................................................................................................................... 41
Will Delay Interval ...................................................................................................................... 41
Payload Format Indicator ........................................................................................................... 42
Message Expiry Interval ............................................................................................................. 42
Content Type .............................................................................................................................. 42
Response Topic ......................................................................................................................... 43
Correlation Data ......................................................................................................................... 43
User Property ............................................................................................................................. 43
3.1.3.3 Will Topic ........................................................................................................................................... 43
3.1.3.4 Will Payload ....................................................................................................................................... 43
3.1.3.5 User Name ......................................................................................................................................... 44
3.1.3.6 Password ........................................................................................................................................... 44
3.1.4 CONNECT Actions .................................................................................................................... 44
3.2 CONNACK – Connect acknowledgement ........................................................................................ 45
3.2.1 CONNACK Fixed Header .......................................................................................................... 45
3.2.2 CONNACK Variable Header ..................................................................................................... 46
3.2.2.1 Connect Acknowledge Flags.............................................................................................................. 46
Session Present .............................................................................................................................. 46
3.2.2.2 Connect Reason Code ....................................................................................................................... 47
3.2.2.3 CONNACK Properties ........................................................................................................................ 48
Property Length .......................................................................................................................... 48
Session Expiry Interval ............................................................................................................... 48
Receive Maximum ...................................................................................................................... 48
Maximum QoS ........................................................................................................................... 49
Retain Available ......................................................................................................................... 49
Maximum Packet Size ................................................................................................................ 50
Assigned Client Identifier ........................................................................................................... 50
Topic Alias Maximum ................................................................................................................. 50
Reason String ............................................................................................................................ 51
User Property ........................................................................................................................... 51
Wildcard Subscription Available ............................................................................................... 51
Subscription Identifiers Available ............................................................................................. 51
剩余148页未读,继续阅读
资源评论
mikr_pig
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功