Coder Social home page Coder Social logo

Setting observe lifetime about libcoap HOT 8 CLOSED

mikefoxTB avatar mikefoxTB commented on July 18, 2024
Setting observe lifetime

from libcoap.

Comments (8)

mrdeep1 avatar mrdeep1 commented on July 18, 2024

I can find nothing in RFC7641 that defines a lifetime option for use with a CoAP request. The Max-Age option is used for responses, not requests, but would be most closely aligned with what you are trying to do, but the client and server would need to be coded appropriately to understand this.

What is the motivation behind doing this?

from libcoap.

mikefoxTB avatar mikefoxTB commented on July 18, 2024

The idea is mentioned in: https://datatracker.ietf.org/doc/id/draft-ietf-core-observe-01.html
We have an unreliable constrained network and several clients, with a lifeime option the clients can renew their observations and the server can prune expired observations.

from libcoap.

cabo avatar cabo commented on July 18, 2024

The idea is mentioned in: https://datatracker.ietf.org/doc/id/draft-ietf-core-observe-01.html

Which is the path not taken. We didn't see a need for regular refresh.
Why should the client control how often the server gets to check for its continued presence?

We have an unreliable constrained network and several clients, with a lifeime option the clients can renew their observations and the server can prune expired observations.

The server can check up on observing clients by sending confirmable notifications.
The frequency of these is under server control, as it should.
Compare the last paragraph of section 4.5 1.

from libcoap.

mikefoxTB avatar mikefoxTB commented on July 18, 2024

Got it, the server can use confirmable notifications to detect disconnected clients. Is there any other way? Can Ping/Pong(s) be used? In our situation the notifications are not a regular periodic update but more of a Poisson distribution with long intervals of no updates until at some random point in time there are many updates. During the long intervals of no update, we would like to minimize the traffic and only send notifications to the currently connected clients because of to the constrained network. Advice on to how to do this would be appreciated!

from libcoap.

cabo avatar cabo commented on July 18, 2024

How is it beneficial to get rid of observers when you are not sending notifications anyway?
You can always send an unchanged value as a confirmable notification, that would be your ping/pong.
But why not stay silent and wait for the next actual change?
That indeed minimizes the traffic.

from libcoap.

mikefoxTB avatar mikefoxTB commented on July 18, 2024

The other part of the story is that a multitude of clients come and go, as they "connect" they set up observations and then usually get disconnected in a disorderly manner due to link limitations, (something like a mobile mesh network where parts go out of range of one another unpredictably). We want to have the server efficiently prune the zombie (not connected) clients so when an event does happen, we use bandwidth to communicate with the connected clients and not retry too much on the zombies.
Seems we could do this with confirmable notification from an observable "heartbeat" resource, and both the client and server agree to a loss condition, and once the loss condition occurs both the server and client "knows" they are in a disconnected state and then client can try to reconnect. Does this sound Ok?

from libcoap.

mrdeep1 avatar mrdeep1 commented on July 18, 2024

Confirmable Observable "heartbeat" resource would work. You need to determine the frequency of unsolicited response to make sure that any interim NAT device has its mapping tables kept "warm", and monitor the alerts / nacks generated. See coap_handler(3).

It is also possible/permissible for the server to initiate a CoAP Ping request to illicit a CoAP pong response back from the client. This is not automatically supported by libcoap at present (but is supported when initiated by the client using coap_keepalive(3)). The downside compared to the observable "heartbeats" is that no (state etc.) information can be carried using CoAP Ping/Pong.

Recently added is support for server restarts maintaining observe information so that the client does not need to re-register following a server reboot (only works for UDP, not DTLS sessions). See coap_persist(3).

from libcoap.

mikefoxTB avatar mikefoxTB commented on July 18, 2024

Thank you for the guidance, it is always a balance adding "features" to a protocol or letting applications do something on their own and each differently.
Perhaps a "well known" resource named ("heartbreak") is in order to allow generic applications to register and receive the server's update period, and then the client could decide to try and reregister if it did not receive the update at the expected time.

from libcoap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.