Coder Social home page Coder Social logo

Comments (5)

jasta avatar jasta commented on July 25, 2024 1

PUT, POST, and DELETE can automatically trigger a resource change event, however we have to be careful there because only certain response codes would indicate that a change indeed occurred. For example, a PUT request that is rejected with 4.xx should not trigger notifications. I think I can come up with a best effort set of cases that should cover common uses but still be flexible for developers to control how it works.

from coap-rs.

Covertness avatar Covertness commented on July 25, 2024

I'm glad to hear that the repository can help you.

The first change is wonderful. The observer feature will be easier to use. But the other changes will break the origin definition from RFC 7641. I think they are not fit for the coap library. please correct me if i misunderstood.

from coap-rs.

jasta avatar jasta commented on July 25, 2024

I'm interested to learn more about your concerns on the other changes. I informed my original recommendation by reading RFC 7641 and other CoAP server implementations and as I understand it the intention of RFC 7641 is that observe notifications should be identical with the exception of the Observe/Token options to simply re-issuing a GET request. More formally, an observed GET request should yield a stream of updates that are eventually consistent with any future regular GET request. Thus logically saying that a resource changed is most consistent with simply presuming that to be the same as making a GET request and sending the response with the Observe/Token options synthesized onto the response.

Also note regarding #3, I meant to say that a failed GET request would logically deny observation and that it would not be tied to the PUT request at all (currently coap-rs simply yields a 4.04 if you issue a GET Observe:0 request to something that you have not previously PUT into). I wrongly implied that the coap-rs implementation would require all GET requests to be observable. That said, a handler should be able to deny observability in the current implementation by simply yielding a 4.xx code if the Observe flag is set which should cover our bases.

Do you have an example of something you'd prefer to see that better matches how RFC 7641 is defined?

from coap-rs.

Covertness avatar Covertness commented on July 25, 2024

You are right. Some functions are not implement. But I think the former actions should be reserved, e.g. the PUT request automatically affect resources.

from coap-rs.

jasta avatar jasta commented on July 25, 2024

Unfortunately after trying pretty hard to make Observe support integration work I've decided I need to go a different direction and start a new project with a higher level API goal for cleaner integration: https://github.com/jasta/coap-server-rs. While coap-rs has been extremely useful in getting me started there are some pretty significant architectural challenges that would need to be overcome for good generic support for more advanced features and that would end up taking the project in a very different direction with potentially a lot of disruption to current users. For now I'm choosing to incubate a more experimental but convenient approach in the linked repo above (which does have transparent Observe and Block-wise support)

For an example of how this new API I'm using supports observe, see: https://github.com/jasta/coap-server-rs/blob/main/examples/app_observable.rs

from coap-rs.

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.