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

How to listen observe relation lifecycle ? #2221

Closed
sbernard31 opened this issue Feb 13, 2024 · 4 comments
Closed

How to listen observe relation lifecycle ? #2221

sbernard31 opened this issue Feb 13, 2024 · 4 comments

Comments

@sbernard31
Copy link
Contributor

About cf 3.x, To implement LWM2M write attributes at client side, I need to alter default coap observe behavior at coap server side .

I almost succeed to get a working version. (even if I don't really like the code I written in Leshan 😞)
Anyway, to do that I have kind of store which hold some data for each relation for each relation. Those data contain how the behavior is altered.

The last (known) remaining problem:
My current issue is I don't find a right way to do housekeeping of those data.
Ideally I should be able to remove my data when observe relation is removed too.

Any Idea ?

@sbernard31
Copy link
Contributor Author

As I didn't find a way to listen observe relation lifecycle, I fallback to a not Ideal solution by hooking some housekeeping code in several places. I tried to hook to all the cases which could lead to end an observe relation at coap server (RST on notification, notification with error code, receive observe with observe option =1). Hoping I didn't missed an existing one OR new one will not be added.

Anyway, If you have better idea, please let me know.

@boaks
Copy link
Contributor

boaks commented Feb 23, 2024

ResourceObserver. Not sure, if that has a chance to work on removing the resource itself. I'm in vacation and will be back next week. If it doesn't work, maybe we consider an updated API for that with Cf 4.0 (and start with that I hope on April, when I finished some other pending stuff in this and other projects.)

@sbernard31
Copy link
Contributor Author

Thx for sharing that. I totally missed this API.

I tired to use it and it seems it works for my need. (at least is OK with my unit tests)

Not sure, if that has a chance to work on removing the resource itself.

I didn't test that for now.

I think we can close this issue ?

@boaks
Copy link
Contributor

boaks commented Feb 27, 2024

I think we can close this issue ?

At least for v 3.x.y

@boaks boaks closed this as completed Feb 27, 2024
sbernard31 added a commit to eclipse-leshan/leshan that referenced this issue Feb 28, 2024
sbernard31 added a commit to eclipse-leshan/leshan that referenced this issue Mar 5, 2024
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