对于物联网传输协议 ，主要分两大类 （只讨论无线传输）
接入协议 和 通信协议
注：REST 是一种规范， 存在3种规范 为RPC/SOAP/REST. REST FUL/ HTTP 为遵守REST规范的一种HTTP协议
There are many communication protocols which can be used by the IoT gateway to communicate with the cloud application. Here we discuss some of the more popular technologies along with their pros and cons.
Plain HTTP: This is by far the most ubiquitous protocol. It’s widely accepted by servers and being backed by Internet standards has least compatibility issues. It also maps naturally with the RESTful APIs.However it suffers from large overhead in form of HTTP headers andtext based format. It is stateless despite being run on top of TCP. That makes it unsuitable for real-time usage. The client must send a request in order to get a response (command) from the server.Client has to keep polling for updates from the server.
CoAP: Constrained Application Protocol can be considered to be binary version of HTTP. It improves on some limitations on HTTP. It has very concise headers and supported binary data format thus reducing the overhead. It can be used on top of TCP or other transport as well even SMS. CoAP packets can be easily translated toa HTTP packet. However because of negligible Internet infrastructure support it does not play well with firewalls,proxies and routers. Thus this protocol is only suitable for private networks typically inside the sensor network.
Web sockets: It is a new protocol also backed by web standards. It has the same addressing and handshake mechanism as used by HTTP. Thus making it compatible with existing network infrastructure. Oncehandshake is complete it switches to duplex communication on top of TCP. This makes it suitable forreal time, two way communication. It’s especially suitedin shared hosting environments and gateways operating behind proxies.
MQTT: Is also a popular protocol running (optionally) on top of TCP. It has a topic subscriber model. Though more suited for broadcasting messages to interested gateways, it’s also used forgateway to server communication. It has some features like last message persistence and will and testament message that make it useful for IoT application.
AMQP: This perhaps is the most suited protocol for gateway server communication. This protocol acts as a storing queue and ensures that packets are not lost, even incase of temporary outage.
XMPP: Extensible Messaging and Presence Protocol is a popular protocol used by chat clients for real time communication. It standardizeslot of things like user authentication and message IDs. However owing to its complex specification and exchange of data using verbose XML format makes it unsuitable for IoT application.案例阅读：Internet of Things Gateway Platform and Applications A discussion of challenges in designing an IoT gateway and designing a generic Gateway platform