mqtt协议一瞥

IoT是Internet of Things的缩写,字面翻译是“物体组成的因特网”,准确的翻译应该为“物联网”。物联网(Internet Of Things)又称传感网,简要讲就是互联网从人向物的延伸。

引用自 IOT(物联网)_百度百科

MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium. For example, it has been used in sensors communicating to a broker via satellite link, over occasional dial-up connections with healthcare providers, and in a range of home automation and small device scenarios. It is also ideal for mobile applications because of its small size, low power usage, minimised data packets, and efficient distribution of information to one or many receivers.

引用自 mqtt.org

MQTT(Message Queuing Telemetry Transport,消息队列遥测传输)是IBM开发的一个即时通讯协议,有可能成为物联网的重要组成部分。

引用自 MQTT_百度百科

MQTT is a lightweight messaging protocol that is based on publish/subscribe pattern. Due to its low overhead and simplicity, this protocol is suitable for use in IoT and M2M applications.

引用自 Request/Response Pattern Over MQTT | Bitreactive

MQTT - MQ Telemetry Transport

轻量级的 Machine-to-Machine 通信协议。 Publish/Subscribe模式。基于TCP/IP。支持QoS。适合于低带宽、不可靠连接、嵌入式设备、CPU内存资源紧张。是一种比较不错的Android消息推送方案。 FacebookMessenger采用了MQTT。 MQTT有可能成为物联网的重要协议。

引用自 MQTT协议简记 - cacard - 博客园

Why MQTT?

It is a publish/subscribe protocol It has Multiple Quality of Service levels (QOS) It has at-least-once and exactly-once semantics It has a low overhead (2 bytes at minimum) It supports offline messaging It retains messages, like a key/value store

引用自 Getting started with MQTT | The Jackal of Javascript

简言之, mqtt 就是简单高效基于 发布/订阅消息传输协议 ,主要用于资源受限设备(如:传感器、手机等)与服务器间有保障地进行消息或事件推送。

有一些人(或项目)在尝试将 mqtt 扩展到其它用途

请求/响应模型(Request/Response)
Request/Response Pattern Over MQTT | Bitreactive
远程过程调用(RPC)
wolfeidau/mqtt-rpc
包裹WEB服务(REST)
REST over MQTT for Constrained Devices/Mobiles | Prithiviraj Damodaran

IoT领域的其它竞争对手

CoAP

Constrained Applications Protocol

基于 UDP 协议,简化版的 HTTP/2

The Constrained Application Protocol (CoAP) is a specialized web transfer protocol for use with constrained nodes and constrained networks in the Internet of Things. The protocol is designed for machine-to-machine (M2M) applications such as smart energy and building automation.

引用自 CoAP — Constrained Application Protocol

HTTP/2

HTTP/2 (originally named HTTP/2.0) is the second major version of the HTTP network protocol used by the World Wide Web

Can HTTP/2 Replace MQTT? - Tim Kellogg

HTTP/2 - The New IoT Protocol?

HTTP/2 and the Internet of Things

MQTT vs Websockets vs HTTP/2: The Best IoT Messaging Protocol?

What’s in HTTP/2 for the Internet of Things? 1/2 | Web of Things

个人总结

HTTP/2 做为一种通用的应用层协议,由于被广泛部署,有着天然的优势,但是 mqtt 带来的 Machine-To-Machineofflinebridge 消息传输,现在就可以应用到产品中。

或许将来有一天会出现构建于 HTTP/2 上的类 mqtt 解决方案,它能够运行在绝大多数的资源内限嵌入式设备上,在这之前 mqtt 之类的成熟的应用层协议会有一席之地,特别是在它完美契合你的应用的情况下。

做为一个开发者,与其坐等完美的解决方案出现,还不如立即开始学习 mqtt ,应用 mqtt ,从 mqtt 中学到协议设计的经验与技术,以至成为实现构建于 HTTP/2 上的类 mqtt 解决方案的那个人。