Search code examples
coap

CoAP confirmable response


My server exposes a set of measurements but only those that have not been read yet. For this purpose, I have only implemented a single resource /new that discards measurements that it has just sent after a GET request. How can I make the server wait for the requester to acknowledge the reception of the response?

I know this is not fully respectful of CoAP semantics but it would still be useful for me. I mean the server would only discard readings that have actually been received by some client.


Solution

  • You probably solved it (in that case could you tell which approach did you use? i am interested). Anyway i think you should use the Token (https://www.rfc-editor.org/rfc/rfc7252#section-5.3.1). This is what i would do:

    1. Client sends a CON request to server containing the message token.

    2. Server sends an empty ACK with same token.

    3. Server sends a CON response containing the same token and the set of measurements.

    4. Client sends an empty ACK with same token.

    5. Server can now delete read resources.