CoAP

The CoAP implementation exhanges CoAP messages on top of a Nabto connection between a client and a device.

CoAP example:

NabtoClientCoap* coap = nabto_client_coap_new(connection, "GET", "/temperature/living_room");
NabtoClientFuture* future = nabto_client_coap_execute(coap);
nabto_client_future_wait(future);
nabto_client_future_free(future);

uint16_t statusCode;
uint16_t contentFormat;
nabto_client_coap_get_response_status_code(coap, &statusCode);
nabto_client_coap_get_response_content_format(coap, &contentFormat);
void* responsePayload;
size_t responsePayloadLength;
nabto_client_coap_get_response_payload(coap, &responsePayload, &responsePayloadLength);

Do stuff here with the response.

nabto_client_coap_free(request);