chrysn / aiocoap

The Python CoAP library
Other
267 stars 120 forks source link

Creating URI for the request without coap scheme #329

Closed Pawlicho closed 1 year ago

Pawlicho commented 1 year ago

Hi, Is it possible to somehow change the 'scheme' for all URIs? I mean to send the request I for example need to send this request to coap://host/resource. Am I able to set the server context to simply be able to send requests onto host/resource?

chrysn commented 1 year ago

Please elaborate on what you're attempting here, I don't quite understand the question.

CoAP fundamentally works on URIs, as the options for path etc. are defined to be interchangable with a full URI (which, by definition, contains a scheme).

Or do you want to send requests using URI references? For that, you'll always need to know a base URI. The Python urllib.parse.urljoin function allows you to evaluate any reference on a given base. There is currently no feature in aiocoap that uses this in navigation, but it's well imaginable that a stateful context (or one derived from a response) that processes relative references in requests makes sense -- but if this is to be added, it'd be helpful to understand fully what you are trying to achieve.

Pawlicho commented 1 year ago

I apologise for the trouble. My question was connected to the lack of understanding CoAP protocol or even lack of knowledge in application protocol background. "coap://" prefix in URI is common for every CoAP application similiar as http/https etc.

Closing the issue.