Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.


Repository files navigation

LibNyoci — A Full-Featured Embedded CoAP Stack

LibNyoci is a highly-configurable CoAP stack which is suitable for a wide range of embedded devices, from bare-metal sensor nodes with kilobytes of RAM to Linux-based devices with megabytes of RAM.

LibNyoci was spun off from the SMCP project in late March of 2017.

Features include:

  • Supports RFC7252
  • Fully asynchronous I/O
  • Supports both BSD sockets and µIP
  • Sending and receiving asynchronous CoAP responses
  • Observing resources and offering observable resources
  • Retransmission of confirmable transactions
  • Experimental support for DTLS

The package also includes nyocictl, a powerful command line tool for browsing and configuring CoAP nodes.

LibNyoci is currently working toward a v1.0 API. Until v1.0 is released, all APIs are subject to change.

Getting Help

If you are having trouble with LibNyoci, you can either file an issue on github or join the official LibNyoci Developers mailing list and ask your question there.

Mailing Lists

Getting, building, and installing via Git


$ git clone git://
$ cd libnyoci

To just build the latest tagged stable release:

$ git checkout full/latest-release
$ ./configure
$ make
$ sudo make install

For bleeding-edge:

$ git checkout master
$ git archive origin/autoconf/master | tar xvm
  # Next line is a work-around for timestamp problems
$ touch aclocal.m4 && touch configure && touch `find . -name '*.in'`
$ ./configure
$ make
$ sudo make install

Getting, building, and installing from an archive

$ curl >
$ unzip
$ cd nyoci-latest-release
$ ./configure
$ make
$ sudo make install

Installing via Homebrew on OS X

To get the "latest-release":

$ brew tap darconeous/embedded
$ brew install libnyoci

To get the bleeding-edge release:

$ brew tap darconeous/embedded
$ brew install libnyoci --HEAD

Getting Started

The best way to get started is to have a look at some example code which uses LibNyoci. There are several included examples:

  • examples/example-1.c - Shows how to respond to a request.
  • examples/example-2.c - Shows how to respond to a request for a specific resource.
  • examples/example-3.c - Shows how to use the node router.
  • examples/example-4.c - Shows how to make resources observable.

Additionally, there is the plugtest server and client, which can be found in src/plugtest.

The Contiki version of the plugtest uses the last two files. You can find the Contiki version at contiki-src/examples/nyoci-plugtest/.


One of the goals of LibNyoci is to implent a full-featured CoAP library, but most embedded applications don't need all of these capabilities. Because of this, LibNyoci is designed so that you can individually enable or disable features depending on your needs (See src/libnyoci/

For example, LibNyoci has the ability to have more than once instance, but embedded platforms will never need more than one. Passing around a reference to a global variable that will never change is wasteful, so when compiled with NYOCI_SINGLETON turned on, we transparently (via some preprocessor magic) ignore the reference to the LibNyoci instance from all of the functions that take it. This makes it easy to use the same codebase for both embedded and non-embedded applications. There are other configuration options for doing things like limiting malloc() usage, avoiding use of printf() (and variants), enabling/disabling observing, etc.

Contiki Support

LibNyoci supports Contiki (albeit a rather old version). To build the Contiki examples, just make sure that the CONTIKI environment variable is set point to your Contiki root, like so:

$ cd contiki-src/examples/nyoci-simple
$ make CONTIKI=~/Projects/contiki TARGET=minimal-net

API Documentation

You can find an online version of the API documentation here:


nyocictl is a command-line interface for browsing, observing, and interacting with CoAP devices. It is, for the most part, self-documenting: just type in nyocictl help. You can run individual commands directly from the command line when invoking nyocictl or you can invoke with no arguments and you will enter the nyocictl shell (CLI). The shell environment allows you to use familiar unix commands like ls, cd, and cat. The CLI supports quoting and tab-completion of resource names, which is incredibly handy.

Here are a few examples of how you can use it:

GET a resource

$ nyocictl get coap://

Listing the contents of a resource

$ nyocictl ls coap://

PUT a resource and show parsed response headers

$ nyocictl put -i coap:// "Testing out nyocictl's PUT command"

Observe a resource for changes

$ nyocictl observe coap://


nyoci-plugtest-server implements some of the ESTI plugtests for CoAP.

List of Public Test Servers

These servers run a subset of the plugtest suite:

  • coap://
  • coap://

These are other publically-accessable example/test servers:

  • coap://
  • coap://

Authors and Significant Contributors

Special Thanks