Skip to content

unicoap: Unified CoAP Suite

unicoap is RIOT’s unified and modular framework for communication via the Constrained Application Protocol (CoAP). It supports different transports and several CoAP features through a layered and modular design. Support for each CoAP transport, such as UDP, is available through driver modules.

unicoap aims to eventually replace net_gcoap, net_nanocoap, and net_nanosock, in favor of a more beginner-friendly and extensible design.

unicoap is work in progress. Not all functionality is implemented in RIOT yet, although the documentation already exists. Do not expect everything to work yet.

The Constrained Application Protocol (CoAP) is a lightweight alternative to HTTP. HTTP as a general-purpose application protocol carries a significant overhead and is thus problematic for IoT networks with limited bandwidth and nodes with little memory. CoAP covers a range of features needed in the IoT, such as resource discovery, message fragmentation, and end-to-end message protection.

In your application’s Makefile, add:

USEMODULE += unicoap
USEMODULE += unicoap_driver_udp

unicoap enables support for CoAP over various transport protocols. Currently, it supports the UDP and DTLS drivers. You must specify at least one driver to use networking functionality. If you only want to use the message APIs, see Using Message APIs. To create a CoAP server, see Writing a Server Application. The RFC 7252 PDU format is covered in Parsing and Serialization. For implementation details, see Behind The Scenes of unicoap.