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

clientGET-observe constantly sending updates #59

Closed
Lowell96 opened this issue Mar 14, 2017 · 4 comments
Closed

clientGET-observe constantly sending updates #59

Lowell96 opened this issue Mar 14, 2017 · 4 comments

Comments

@Lowell96
Copy link

Lowell96 commented Mar 14, 2017

Is there any way to code the observe program to only send updates on change. so If I am sending some data to the server every 10 mins or so then I only want it to update then. currently I have edited clientGet-observe.py program so that it gets the temperature topic but it receives and loops through this data constantly even when there has been no update sent. is there anyway to change this. thanks

@chrysn
Copy link
Owner

chrysn commented Mar 15, 2017

I'm not sure I really get what you want. If you run clientGET-observer against an external server, it will output a line every time the server sends a new status, independently of whether it changed or not. If you are seeing needless updates here, you could of course make the client display only changes, but really the server should send updates only when either the state changed or considerable time has passed.

Is this issue about the server sending too many updates (is it an aiocoap server / what does it do?), or would you expect the async for r in request.observation to only produce results if they are not identical to the previous response?

@Lowell96
Copy link
Author

Lowell96 commented Mar 16, 2017

Sorry what I meant was is there any way that I can get it to only send a message to the observer when something is PUT on the server topic being observed. almost how MQTT works when it get notifications for the topics it is subscribed to.

@chrysn
Copy link
Owner

chrysn commented Mar 21, 2017

The server should currently send a notification exactly when you call a resource's .update_state() method. Only the server.py example script sends abundant messages; this is to ease testing (I wouldn't want to wait a minute to see the next update), and you wouldn't do that in real servers.

It also shows that with CoAP observe, you must not rely on there always being a resource state change when you obtain a new value. CoAP observation provides eventual consistency, not an event messaging system.

(As this is already more of a question issue,) What problem do you actually want to solve?

@chrysn
Copy link
Owner

chrysn commented Apr 10, 2017

It seems the question is answered, feel free to reopen if there is more.

@chrysn chrysn closed this as completed Apr 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants