没有合适的资源?快使用搜索试试~ 我知道了~
首页MQTT协议,可以用于实现Android的push功能。
MQ Telemetry Transport (MQTT) is a lightweight broker-based publish/subscribe messaging protocol designed to be open, simple, lightweight and easy to implement.
资源详情
资源评论
资源推荐
Authors:
International Business Machines Corporation (IBM)
Eurotech
MQ Telemetry Transport (MQTT) is a lightweight broker-based publish/subscribe
messaging protocol designed to be open, simple, lightweight and easy to implement.
These characteristics make it ideal for use in constrained environments, for example,
but not limited to:
Where the network is expensive, has low bandwidth or is unreliable
When run on an embedded device with limited processor or memory resources
Features of the protocol include:
The publish/subscribe message pattern to provide one-to-many message
distribution and decoupling of applications
A messaging transport that is agnostic to the content of the payload
The use of TCP/IP to provide basic network connectivity
Three qualities of service for message delivery:
"At most once", where messages are delivered according to the best efforts of
the underlying TCP/IP network. Message loss or duplication 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.
"At least once", where messages are assured to arrive but duplicates may
occur.
"Exactly once", where message 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 (the fixed-length header is just 2 bytes), and protocol
exchanges minimised to reduce network traffic
A mechanism to notify interested parties to an abnormal disconnection of a client
using the Last Will and Testament feature
© 1999-2010 Eurotech, International Business Machines Corporation (IBM). All rights
MQTT V3.1 Protocol Specification
1 of 42
reserved.
Permission to copy and display the MQ Telemetry Transport specification (the
"Specification"), in any medium without fee or royalty is hereby granted by Eurotech
and International Business Machines Corporation (IBM) (collectively, the "Authors"),
provided that you include the following on ALL copies of the Specification, or portions
thereof, that you make:
A link or URL to the Specification at one of the Authors' websites.1.
The copyright notice as shown in the Specification.2.
The Authors each agree to grant you a royalty-free license, under reasonable,
non-discriminatory terms and conditions to their respective patents that they deem
necessary to implement the Specification. THE SPECIFICATION IS PROVIDED "AS IS,"
AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE
CONTENTS OF THE SPECIFICATION ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE
IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY
PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. THE AUTHORS WILL NOT
BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
SPECIFICATION.
The name and trademarks of the Authors may NOT be used in any manner, including
advertising or publicity pertaining to the Specification or its contents without specific,
written prior permission. Title to copyright in the Specification will at all times remain
with the Authors.
No other rights are granted by implication, estoppel or otherwise.
MQTT V3.1 Protocol Specification
2 of 42
This specification is split into three main sections:
the message format that is common to all packet types,
the specific details of each packet type,
how the packets flow between client and server.
Information on how topic wildcards are used is provided in the appendix.
The following are the changes between MQTT V3 and MQTT V3.1:
User name and password can now be sent with a CONNECT packet
New return codes on CONNACK packets, for security problems
Clarification that clients are not informed of un-authorized PUBLISH or SUBSCRIBE
commands, and that the normal MQTT flow should complete even though the
command has not been performed.
Strings in MQTT now support full UTF-8, instead of just the US-ASCII subset.
The protocol version number passed with CONNECT packets, is unchanged for this
revision, and remains as the "3". Existing MQTT V3 server implementations should be
able to accept connections from clients that support this revision, as long as they
correctly respect the "Remaining Length" field, and therefore ignore the extra security
information.
MQTT V3.1 Protocol Specification
3 of 42
The message header for each MQTT command message contains a fixed header. Some
messages also require a variable header and a payload. The format for each part of the
message header is described in the following sections:
The message header for each MQTT command message contains a fixed header. The
table below shows the fixed header format.
bit 7654 3 2 1 0
byte 1 Message Type DUP flag QoS level RETAIN
byte 2 Remaining Length
Byte 1
Contains the Message Type and Flags (DUP, QoS level, and RETAIN) fields.
Byte 2
(At least one byte) contains the Remaining Length field.
The fields are described in the following sections. All data values are in big-endian
order: higher order bytes precede lower order bytes. A 16-bit word is presented on the
wire as Most Significant Byte (MSB), followed by Least Significant Byte (LSB).
Message Type
Position: byte 1, bits 7-4.
Represented as a 4-bit unsigned value. The enumerations for this version of the
protocol are shown in the table below.
Mnemonic Enumeration Description
Reserved 0 Reserved
CONNECT 1 Client request to connect to Server
CONNACK 2 Connect Acknowledgment
PUBLISH 3 Publish message
PUBACK 4 Publish Acknowledgment
MQTT V3.1 Protocol Specification
4 of 42
Mnemonic Enumeration Description
PUBREC 5 Publish Received (assured delivery part 1)
PUBREL 6 Publish Release (assured delivery part 2)
PUBCOMP 7 Publish Complete (assured delivery part 3)
SUBSCRIBE 8 Client Subscribe request
SUBACK 9 Subscribe Acknowledgment
UNSUBSCRIBE 10 Client Unsubscribe request
UNSUBACK 11 Unsubscribe Acknowledgment
PINGREQ 12 PING Request
PINGRESP 13 PING Response
DISCONNECT 14 Client is Disconnecting
Reserved 15 Reserved
Flags
The remaining bits of byte 1 contain the fields DUP, QoS, and RETAIN. The bit positions
are encoded to represent the flags as shown in the table below.
Bit position Name Description
3 DUP Duplicate delivery
2-1 QoS Quality of Service
0 RETAIN RETAIN flag
DUP
Position: byte 1, bit 3.
This flag is set when the client or server attempts to re-deliver a PUBLISH,
PUBREL, SUBSCRIBE or UNSUBSCRIBE message. This applies to messages where
the value of QoS is greater than zero (0), and an acknowledgment is required.
When the DUP bit is set, the variable header includes a Message ID.
The recipient should treat this flag as a hint as to whether the message may have
been previously received. It should not be relied on to detect duplicates.
QoS
Position: byte 1, bits 2-1.
This flag indicates the level of assurance for delivery of a PUBLISH message. The
QoS levels are shown in the table below.
MQTT V3.1 Protocol Specification
5 of 42
剩余41页未读,继续阅读
mythfish
- 粉丝: 21
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 2023年中国辣条食品行业创新及消费需求洞察报告.pptx
- 2023年半导体行业20强品牌.pptx
- 2023年全球电力行业评论.pptx
- 2023年全球网络安全现状-劳动力资源和网络运营的全球发展新态势.pptx
- 毕业设计-基于单片机的液体密度检测系统设计.doc
- 家用清扫机器人设计.doc
- 基于VB+数据库SQL的教师信息管理系统设计与实现 计算机专业设计范文模板参考资料.pdf
- 官塘驿林场林防火(资源监管)“空天地人”四位一体监测系统方案.doc
- 基于专利语义表征的技术预见方法及其应用.docx
- 浅谈电子商务的现状及发展趋势学习总结.doc
- 基于单片机的智能仓库温湿度控制系统 (2).pdf
- 基于SSM框架知识产权管理系统 (2).pdf
- 9年终工作总结新年计划PPT模板.pptx
- Hytera海能达CH04L01 说明书.pdf
- 数据中心运维操作标准及流程.pdf
- 报告模板 -成本分析与报告培训之三.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论13