Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does deleting an object instance implicitly delete observations under the instance? #558

Open
bryan-aetheros opened this issue Jan 27, 2023 · 1 comment

Comments

@bryan-aetheros
Copy link

The LwM2M spec does not specify what happens to an object instance's observations when a server deletes the object instance.
For example, if a server has installed an observation on /5/0/3, then deletes /5/0 and subsequently creates a new /5/0, should the server assume that the observation on /5/0/3 no longer exists, and should be reinstalled?

Thanks,
Bryan

@bryan-aetheros bryan-aetheros changed the title Does deleting an object instance implicitely delete observations under the instance? Does deleting an object instance implicitly delete observations under the instance? Jan 27, 2023
@sbernard31
Copy link

Hi,

The LWM2M observation feature is based on RFC7641 - Observing Resources in the Constrained Application Protocol (CoAP).

Looking at RFC7641§3.2 Notifications, you can read :

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.

and at RFC7641§4.2 Notifications :

A notification SHOULD have a 2.05 (Content) or 2.03 (Valid) response
code. However, in the event that the state of a 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 SHOULD notify the client by sending a notification with an
appropriate response code (such as 4.04 Not Found) and subsequently
MUST remove the associated entry from the list of observers of the
resource.

(Note in LWM2M, the LWM2M client acts as a CoAP server and vice versa )

So In a general way, I understand that if the object instance is deleted (for any reason), the LWM2M client (CoAP server) should send a 4.04 Not Found, then removes the observation relation. I guess LWM2M server (CoAP client) should also consider the relation is removed when he received a notification with a non-2.xx response code.

For example, if a server has installed an observation on /5/0/3, then deletes /5/0 and subsequently creates a new /5/0, should the server assume that the observation on /5/0/3 no longer exists, and should be reinstalled?

I understand it should reinstall.

(Note that I'm not author of any those specifications LWM2M or CoAP)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants