-
Notifications
You must be signed in to change notification settings - Fork 14
Draft: New WASM implementation #19
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
base: main
Are you sure you want to change the base?
Conversation
3e75043
to
1a059a9
Compare
The new wasm-implementation seems to work. I added an assertion that |
I got the same |
It might eventually get merged, but it's not on my todo list right now. The problem is that WebSocket will not be Sync on native due to limitations by hyper. It might be nice to have only the Send bound for both targets though. The point is that the current implementation works, and I'm hesitant to switch it out with something that might break things. What is the specific problem you have? I might be able to help with a workaround. |
Hi, @jgraef, thanks for your quick reply! I'm try to turn a I will try the code of this branch and see if it solve my problem. |
This branch is a little bit out of date, but should work fine. As far as I can tell StreamReader/StreamWriter doesn't have a Send bound. The requirement for a Send bound usually comes when you move a type across thread boundaries. But there are no threads in WASM. For example Feel free to reach out if you run into any problems with this branch. I might even bring it up-to-date with the master branch, if you need that. After all it's good to know that this feature is needed :) |
This implementation spawns a local task, which drives the websocket connection. The
WebSocket
struct that the user gets only contains channels to communicate with the task. This way theWebSocket
isSend
.