Set options with a json encoded document.

There are two ways to setup connection options. Either use the unified json interface which has all possible options, or use the individual set functions for the most commonly used connection options.

This functions can be used to set connection parameters in bulk or as indidual parameters.

`` Connection options.

  • PrivateKey: string pem encoded EC private key
  • ProductId: string
  • DeviceId: string
  • ServerUrl: string
  • ServerKey: string
  • ServerJwtToken: string
  • ServerConnectToken: string
  • AppName: string
  • AppVersion: string </code>``

Control the keep alive settings for the connection between the client and the device. ``

  • KeepAliveInterval: unsigned integer in milliseconds, default 30000
  • KeepAliveRetryInterval: unsigned integer in milliseconds, default 2000
  • KeepAliveMaxRetries: unsigned integer default 15 </code>``

Control which connections features to use.

Set local to enable/disable local connections ``

  • Local: (true|false) </code>``

Enable/disable connections mediated through a cloud server. ``

  • Remote: (true|false) </code>``

Enable/disable udp holepunching on remote connections. ``

  • Rendezvous: (true|false) </code>``

Use pre 5.2 local discovery. Before 5.2 devices is located by doing a mDNS scan for all the devices. After 5.2 including 5.2, devices are located by a device specific mDNS subtype. Set this option to true to use the pre 5.2 way of locating devices. ``

  • ScanLocalConnect: (true|false) </code>``

Example force local connections:

std::string options = R"(
"Remote": false
nabto_client_connection_set_options(connection, options.c_str());

Example setup a connection

std::string options = R"(
"ProductId": "pr-12345678",
"DeviceId": "de-12345678",
"ServerUrl": "<a href=""">"</a>,
"ServerKey": "sk-12345678123456781234567812345678"
nabto_client_connection_set_options(connection, options.c_str());

This function can only be invoked before the connection establishment is started.


nabto_client_connection_set_options(NabtoClientConnection* connection, const char* json)


[in] The connection
[in] Options formatted as json


NABTO_CLIENT_EC_OK iff the json document is parsed and understood. NABTO_CLIENT_EC_INVALID_ARGUMENT if the json is not understood. See error log for more details.