Covertness/coap-rs

Updating observes from server?

sheosi opened this issue · 10 comments

Hi!!! I want to use CoAP-rs for voice assistant components, and we need to use observe, however, there's no support for updating the resources from the server anymore and trying to access the same server from a client in the same process (as a workaround) throws:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }'

Is server-side resource update planned again, or at least, can the workaround be made to work in the meantime?

Have you try the example? I think it can be work just change the client method get to put

It might be because client and server are in different threads in the example? I might have to try that.

Gave it a try, using that same example and changing CoAPClient::get(url) with CoAPClient::put(url, vec![]) gives the same error as before.

let response = CoAPClient::put(url, vec![]).unwrap(); works on my computer. Which OS you are using?

Maybe. The error occur on a non-blocking socket. The linux has its' own non-blocking system. Have you try to start the client a little later?

That was it, adding a barrier (a oneshot channel too, pretty much anything to sync them up) was enough for the example to work. I still think the underlying problem is not resolved, but maybe this could be added as a workaround? It would be useful to have this in an example, as part of the documentation or even inside the library itself (if it makes sense).

It relates to the OS type. Only a few of OS has the problem. I will add some comments in the example later.

Also, add that the thread is mandatory, otherwise it produces an error as well.

commented