CoAP protocol and protocol MQTT

CoAP协议:Constrained Application Protocol

        CoAP protocol is mainly applied to the resource-constrained device things, it is a message-based protocol request / response model.

CoAP protocol and HTTP The main difference between the agreement:

1. CoAP binary header, HTTP header in text.

2. CoAP reduce the number of head header of available options.

3. CoAP reducing the number of HTTP methods, such as deleting the TRACE, OPTIONS method.

4. CoAP available support detection means.


MQTT协议:Message Queuing Telemetry Transport

        MQTT protocol is message-based client / server publish / subscribe transfer protocol, IBM has released in 1999.

CoAP agreement and MQTT main difference between the agreement:

1. CoAP protocol is a request / response model, MQTT agreement is a publish / subscribe model.

2. CoAP protocol based on UDP protocol, connectionless; the MQTT protocol is based on TCP, the connection length.

3. CoAP is a single protocol for a single transmission of information between the Server and the Client, MQTT a plurality of client-many messaging protocol through the central agency.


transfer method TCP UDP
Message Type Publish / Subscribe Request / Response
Effectiveness of it is good difference
Power general small
Inversion of Control it is good difference
QoS support Yes no



mosquitto is to achieve a proxy server MQTT3.1 protocol. mosquitto install (Ubuntu):

(1) introducing mosquitto warehouse and updates.

sudo apt-get install software-properties-common
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update

(2) Installation mosquitto package.

sudo apt-get install mosquitto

(3) development kits mosquitto installed.

sudo apt-get install libmosquitto-dev

(4) mounted mosquitto client.

apt-get install mosquitto-clients



Quote: "do it yourself design of Things"

Guess you like