java-coap icon indicating copy to clipboard operation
java-coap copied to clipboard

Notification without observe option

Open sbernard31 opened this issue 1 year ago • 3 comments

The RFC7641 - Observing Resources in the Constrained Application Protocol (CoAP) § 3.2. Notifications says :

In the event that the resource changes in a way that would cause a normal GET request at that time to return a non-2.xx response (for example, when the resource is deleted), the server sends a notification with an appropriate response code (such as 4.04 Not Found) and removes the client's entry from the list of observers of the resource. Non-2.xx responses do not include an Observe Option.

I think that currently java-coap doesn't allow this. Because when I try to send a 4.04 Not Found as notification, it is never sent.

I guess this is because of NotificationValidator, see :

https://github.com/open-coap/java-coap/blob/a0c8294df5a35d5f6a001f3fbc4ab85d95a89534/coap-core/src/main/java/com/mbed/coap/server/NotificationValidator.java#L24-L35

Not directly linked but that exception was silently ignore in my code (I mean I didn't even see a log), I don't know if there is something to improve in java-coap or in my code for this last point.

sbernard31 avatar Dec 08 '23 14:12 sbernard31

I think there is more or less same issue at CoAP client side, see https://github.com/open-coap/java-coap/blob/a0c8294df5a35d5f6a001f3fbc4ab85d95a89534/coap-core/src/main/java/com/mbed/coap/server/messaging/CoapDispatcher.java#L65-L68

sbernard31 avatar Dec 08 '23 14:12 sbernard31

any news about that ? :slightly_smiling_face:

sbernard31 avatar Mar 01 '24 13:03 sbernard31

Sorry, nothing yet, I did not have time to look into it.

szysas avatar Mar 04 '24 07:03 szysas