Server ir running a resource /led.
Client8266 is observing the resource /led.
When /led changes state at the Coap Server, it sends packet to Client informing about the change.
Received payload at the Client can be 1 or 0 and it works fine.
Packets received are processed by the function below:
// coap client response callback
void callback_response(coapPacket &packet, IPAddress ip, int port) {
char p[packet.payloadlen + 1];
memcpy(p, packet.payload, packet.payloadlen);
p[packet.payloadlen] = NULL;
//response from coap server
if(packet.type==3 && packet.code==0){
Serial.println("ping ok");
}
Serial.println(p);
}
Question:
How can I identify to what resource the packet refers to?
So far I found no way to know it comes from /led
Thanks in advance.
Paulo