shamblett / coap

A Coap package for dart
Other
16 stars 13 forks source link

feat!: set URI for each request instead of client #160

Closed JKRhb closed 12 months ago

JKRhb commented 1 year ago

I started a new attempt at moving the URL argument from the client to the request methods, making it easier to reuse clients for multiple requests. In theory, this should also make it more efficient to make multiple requests to different endpoints, as they can all use the same socket(s).

At the moment, this PR is still WIP and should be considered experimental, since for now only UDP is covered. It will also require more discussion and needs to address the concerns raised in #93. I will try to come up with a proper solution after #149 is merged, as the dtls2 API should make it much easier to also implement this PR's approach for DTLS.

JKRhb commented 1 year ago

I think this PR should now be ready for initial reviewing/testing :)

JKRhb commented 1 year ago

I think this PR should now be finished for the time being and ready for thorough review. In a follow-up, the TCP network should be fixed/actually completed (I already prepared something locally). Furthermore, the API needs to be adjusted for potentially reconnecting to a peer (for example, if session reuse is discouraged as in the context of ACE-OAuth, c.f. Section 7.1 of RFC 9202).

JKRhb commented 1 year ago

Converted this PR back to a draft since I noticed an issue with the reliability layer in the case of CoAP over DTLS.

JKRhb commented 1 year ago

Converted this PR back to a draft since I noticed an issue with the reliability layer in the case of CoAP over DTLS.

Found a way to fix this and added some additional cleanup.

JKRhb commented 1 year ago

Before considering this PR for merging, I guess it would be better to first merge #169 and then spin off some of the unrelated changes into smaller PRs. However, this PR can already work as a proof of concept that setting the URL for each request works.