Comments (5)
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.
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.
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.
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.
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)
- Server::run abruptly returns when a response payload is too large HOT 4
- Observe requests crash server if the client uses an empty vec![] to represent Observe: 0
- Migrate to Rust 2021 edition HOT 1
- Updating observes from server? HOT 10
- Crash when using python aiocoap HOT 2
- Unexpected panic due to network connectivity state HOT 1
- Outdated documentation refrenced HOT 1
- Message IDs and tokens not set HOT 2
- Client: Separate responses not processed HOT 2
- GET, POST etc. with Uri-Host HOT 2
- Blockwise transfer for with a request payload HOT 4
- Server response retransmission due to duplicate client request (duplicate MID) HOT 3
- Update coap-lite dependency HOT 2
- 0.12.2's update of coap-lite is incompatible HOT 1
- No easy way to set options in client requests HOT 8
- The observer implementation and my use case HOT 7
- Mio 1.8.8 incompatible with newer Tokio versions HOT 3
- observe uses hard-coded default receive timeout HOT 1
- Inject/queue a notification for the Server to dispatch HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coap-rs.