Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating observes from server? #75

Closed
sheosi opened this issue May 2, 2022 · 10 comments
Closed

Updating observes from server? #75

sheosi opened this issue May 2, 2022 · 10 comments

Comments

@sheosi
Copy link

sheosi commented May 2, 2022

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?

@wuyingfengsui
Copy link
Contributor

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

@sheosi
Copy link
Author

sheosi commented May 7, 2022

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

@sheosi
Copy link
Author

sheosi commented May 8, 2022

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

@wuyingfengsui
Copy link
Contributor

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

@sheosi
Copy link
Author

sheosi commented May 9, 2022 via email

@wuyingfengsui
Copy link
Contributor

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?

@sheosi
Copy link
Author

sheosi commented May 12, 2022

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).

@wuyingfengsui
Copy link
Contributor

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

@sheosi
Copy link
Author

sheosi commented May 12, 2022

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

@Covertness
Copy link
Owner

commented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants