eclipse-leshan / leshan

Java Library for LWM2M
https://www.eclipse.org/leshan/
BSD 3-Clause "New" or "Revised" License
653 stars 407 forks source link

[Question] Observation of parent object #1363

Closed horeich closed 1 year ago

horeich commented 1 year ago

Question

Hello,

I'm currently connection to leshan server with a custom client and the following question arised:

How should I handle the case that leshan is sending me a observe request on a parent object or object instance?

For example

Observe /1/0/1 (server)
Notify 1/0/1 (client)
...
...
Observe /1 (server)
Notify /1/0/1 + Notify /1 **OR** only Notify /1 (client)

In other words: does a Notify on the parent object/instance override resource observe or does it append?

I couldn't find a specific description of that case it in the documentation.

Thanks in advance.

Best, Andy

sbernard31 commented 1 year ago

I'm currently connection to leshan server with a custom client

I'm not sure if your custom client is a custimized leshan client or something completely different. (but maybe we don't care :sweat_smile: )

About your scenario, my understanding is it should behave like this :

Observe /1/0/1 (server)
Notify 1/0/1 (client)
...
...  (let's suppose you never cancel the observe on /1/0/1)
...
Observe /1 (server)
Notify /1 (client)  (here we just answer to the observe request  so we only send a notify for /1
... 
... (let's suppose that /1/0/1 resource changed
...
Notify /1/0/1 + Notify /1 (client)
... 
... (let's suppose that /1/0/2 resource changed
...
Notify /1 (client)

In other words: does a Notify on the parent object/instance override resource observe or does it append?

This is 2 different/unrelated observe relation.

If you need to double check how your device should behave concerning observation, you could have a look at : https://www.rfc-editor.org/rfc/rfc7641

horeich commented 1 year ago

Thank you! My example wasn't detailed enough but I think you've got what I meant. I just wasn't sure about the redundancy when observing /1/0/1 and /1. And you're right the origin of this redundancy lies in the underlying protocol. Obviously, I must send both /1/0/1 and /1 because if I sent only /1 I'd violate protocol as it's both CoAP Acknowledgements to the original Observe Request.

Yes, I'm not using Leshan on client side.

Thanks again for your prompt answer, can be closed.

sbernard31 commented 1 year ago

You're welcome :wink: