Embedded Applications

This document describes how to build a Nabto Edge Embedded SDK application. It includes some example applications to get started and use as inspiration.

Focus is on the actual application and configuration necessary to start an application - for information on how to integrate to a new platform, see the integration guide.

Creating device configuration in the Nabto Cloud Console

First, log on to the Nabto Cloud Console. Create a free account if you don’t already have one.

Devices, products and apps

A Nabto Edge product is a logical grouping of devices that makes sense in your business domain. You can have a single Nabto Edge product across all your products. Or e.g. create a product for each product line - or in other ways that make sense.

You can configure a number of client apps that are associated with products. Only client apps using an associated app is allowed to access a given product through the Nabto basestation servers.

Create a product

In the menu on the left, select Products. Create a new product and set an optional friendly display name on the Settings tab.

Create a device

In the Products overview, click the “devices” link in the row of your new product. Click “Create new device”. Later when you have generated a keypair, you must specifiy the public key fingerprint on the device settings page. For bulk operations, there is webservice REST API support for this, contact support for more information.

On the device settings page, you can see the necessary configuration that must later be passed to the Nabto Embedded SDK:


Create an app

Select Apps and create a new app. Set an optional friendly display name on the Settings tab. This step is not really important until you start working on the client app that must access your device.

Associating an app with product

In the products overview, click the “settings” link in the row of your new product. On the “Apps” tab, add your new app. You can have multiple different apps configured to be allowed access to your product.

Again, this step is not critically important to just launch your embedded device. Once you start developing your client app, the association is needed.

Also, when you develop the client, you need to pass the app’s server key (sk-...) and the server url to the Nabto Client SDK. These are retrieved from the products settings page after you setup an association:

Configuring the Embedded Device Application

In the embedded device application, the configuration from the device settings page in the console must be passed to the Nabto Embedded SDK. This is done using the Device Context functions:

    NabtoDevice* device = nabto_device_new();
    NabtoDeviceError ec = nabto_device_set_product_id(device, productId);

Also, a private key is needed on the device. Either this can be created on the device using nabto_device_create_private_key or it can be created outside the application using e.g. openssl and somehow passed to the application:

openssl ecparam -genkey -name prime256v1 -out key.pem

The key is input to the Nabto Edge SDK using nabto_device_set_private_key:

    ec = nabto_device_set_private_key(device, privateKey);

The public key fingerprint can be then be retrieved (and input to the console during development):

    ec = nabto_device_get_device_fingerprint_full_hex(device, &fp);
    if (ec != NABTO_DEVICE_EC_OK) {
        return false;

    printf("Device: %s.%s with fingerprint: [%s]\n", productId, deviceId, fp);

Once the device has been initialized, it can listen for incoming CoAP requests, incoming streams or tunnel requests. Examples of some of these can be found in this section - start with the Hello, World CoAP demo.

It is highly recommended to read about futures in Nabto Edge to understand the CoAP, Stream and Tunnel APIs: Basically the mechanism is a way to have a uniform API that works both synchronously and asynchronously depending on how the future is used. This is described in detail in the futures guide.