
The full form of CoAP is a Constrained Application Protocol. It basically refers to a special transfer protocol for constrained devices. According to RFC 7252, it allows constrained devices, also known as “nodes” to communicate with the wider internet.
Broadly, CoAP is an application layer which translates HTTP and allows a simplified integration with the web. It also meets other specialized tasks like multicast support, simplicity and very low overhead.
CoAP can run on any device which supports UDP. Nowadays, CoAP is used by other mechanisms as well; SMS for example.
Put simply, CoAP is basically a client-server protocol for the IoT (Internet of Things). Here, the client makes a request, which is then sent to the server. Consequently, the server sends back an appropriate response. It works exactly like HTTP. Thus, CoAP is kind of like HTTP for constrained devices, as it allows devices like sensors and actuators to exchange information over the web or IoT.
Moreover, information over the CoAP is transmitted while maintaining high security and reliability. It uses the highest grade security, i.e, DTLS security parameters.
CoAP follows the REST principles and uses UDP to transmit messages. For security, it relies on DTLS parameters While HTTP employs TLS over TCP, CoAP employs Datagram TLS over TCP.
The CoAP utilizes two kinds of layers, namely,
Let's dive deeper into these two layers used by this protocol,
This layer consists of 3 key components: binary header, computer option and payload.
This layer makes use of UDP and transmits messages in CON (Confirmable) and NON (Non Confirmable format). Each message is associated with a unique and distinct ID to avoid the problem of duplicate messages.
The request/response model handles CON and NON-message requests. These are the following cases you can come across,
With the rising importance of CoAP in communication and information, it has become crucial to enable group communication with this protocol. This means, multiple CoAP resources will be addressed at once (as a group), and not as individual units.
For this purpose, an experimental extension for CoAP has been developed. Known as the RFC 7390 (Group Communication for CoAP), it utilizes multicast to transmit messages and requests to every CoAP. While this reduces the time and resources used, multicast is often unreliable.
There is also an alternative to this, where instead of multicasts, unicasts operate the group communication. This is achieved by involving an intermediary. Clients send in group requests to the intermediaries. Next up, the intermediary utilizes unicast and sends the request to individual resources. Once all replies are collected, they are provided to the client in the form of an aggregate response. When compared to the multicast method(which is cache-unfriendly) the unicast is much more reliable and hassle-free.
[wp-faq-schema title=" FULL FORM OF CoAP FAQs" accordion=1]
