Brief Comparison between MQTT and CoAP

MQTT (Message Queuing Telemetry Transport) and CoAP (Constrained Application Protocol) are perhaps the most popular open messaging standards in the Internet of Things (IoT). They are often used as the underlying protocols of the IoT device management (DM) solutions as well. For example, in any end-to-end IoT DM solutions, the DM messages are encapsulated in the MQTT or CoAP messages from one end to another. It’s important to know some high-level differences between them summarized as follows:

Table 1: High-level differences between MQTT and CoAP

MQTT CoAP
Underlying Connection TCP connection Connectionless UDP datagrams
Security TLS based security DTLS based security
Application-level QoS Three levels Two levels
Messaging model Many-to-many One-to-one

First, in Table 1,  CoAP is running on top of UDP, while MQTT is running on top of TCP. Therefore, for message exchange security, MQTT connection can use TLS (Transport Layer Security) while CoAP connection can use DTLS (Datagram Transport Layer Security). 

Second, although MQTT and CoAP follow the client/server model, MQTT is many-to-many protocol that can pass messages between multiple clients, while CoAP is basically one-to-one protocol between a client and a server. This difference is related to the system architecture of the MQTT or CoAP entities but it’s transparent to the upper-layer DM functionalities.

Third, MQTT supports application-level Quality-of-Service in terms of defining some levels of message delivery guarantees, i.e., the messages can be delivered “at most once”, “at least once” and “exactly once”. CoAP supports the delivery of messages in terms of “confirmable” and “nonconfirmable”, where a confirmable message needs an acknowledgement from a receiver while a non-confirmable message is based on best-effort delivery, similar to the “at most once” message delivery option in MQTT.

At last, based on the communication paradigm, MQTT is sometimes referred as a “many-to-many” message protocol, while CoAP is sometimes referred as a “one-to-one” messaging protocol.

For more info about MQTT and CoAP, check the specifications at:

Leave a comment