Skip to content

Lite API: CoAP

Gyeonghwan Hong edited this page Dec 21, 2020 · 6 revisions

Parent Document: ANT APIs

CoAP API takes charge of supporting communications based on CoAP (Constrained Application Protocol).

The CoAP API is composed of CoAP-server functions, CoAP-client functions, and CoAP-common functions.

You need to load CoAP API module before you use its API as following.

var coapAPI = require('coap');

CoAP Server

CoAPAPI.createServer()

  • CoAPServer CoAPAPI.createServer()

CoAPServer.onEvent()

  • void CoAPServer.onEvent(String eventType, Function handler)

CoAPServer.listen()

  • void CoAPServer.listen(Function callback)

CoAPResponse.end()

  • void CoAPResponse.end(String message)

CoAPResponse.get()

  • String CoAPResponse.get()

CoAP Client

CoAPAPI.request()

  • CoAPRequest CoAPAPI.request(String url, String method)

CoAPRequest.onEvent()

  • void CoAPRequest.onEvent(String eventType, Function handler)

CoAPRequest.end()

  • void CoAPRequest.end(void)