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
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 :
and at RFC7641§4.2 Notifications :
(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.
I understand it should reinstall.
(I already answer to this at : https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues/558)