There are some advantages to CoAP:
- Reduced power requirements: It operates over UDP, which requires minimal overhead for communications. It also allows faster wake up times and extended sleepy states. Taken together, this means batteries last longer for IoT devices.
- Smaller packet size: Another advantage of UDP is small packet sizes. This leads to faster communication cycles. Again, this allows batteries to last longer.
- Security: Like MQTT, this is on both the advantage and disadvantage lists. When Datagram Transport Layer Security (DTLS) is employed over UDP, communication is encrypted and secure. Even though there is some additional overhead required to implement this, you can and should use it.
- Asynchronous communication ...