CoAP-simple-library icon indicating copy to clipboard operation
CoAP-simple-library copied to clipboard

REQUEST TYPE

Open follimatteo opened this issue 2 years ago • 1 comments

there is a way to specify a particular request type (GET, POST, PUT) when we ad a callback method with coap.server ?

follimatteo avatar Feb 24 '23 15:02 follimatteo

Hi @follimatteo , You could check the request type at CoapPacket.code . example is like this.

void callback_light(CoapPacket &packet, IPAddress ip, int port) {
  switch (packet.code) {
  case COAP_GET:
    break;
  case COAP_POST:
    break;
  case COAP_PUT:
    break;
  case COAP_DELETE :
    break;
}

hirotakaster avatar Feb 24 '23 19:02 hirotakaster