-
Notifications
You must be signed in to change notification settings - Fork 75
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
Websocket web-sys implementation for wasm #100
Comments
Hi, is there news on it? |
Hi, Sadly, I currently don't have time to add new features to |
What is mainly required to do? To have a general idea. I'm not sure if I could, but I can try to help. |
Thanks for the help, although the solution is a little bit complex. There are two problems to tackle:
|
You're welcome. I was trying to compile message-io and I see the problem with mio. Tungstenite-rs I think is not a problem in the end. For my use case the work-around is conditional compilation for the client. And I could create a WS with web-sys and send messages to the backend that was using message-io. About mio, I see it's not a wip the support for wasm, and even if it'll be async or sync I think it's good to abstract a bit the core from the dependency. Do yo have some idea of that redesign? I'll be not fast also because the time available, but I understand it's not urgent. |
Totally agree. In the first designs, I did not think about targets where
This is the first problem, but modifying the The second problem is how to adapt the I think it could be possible but rewriting a big part of the library. |
Great project! Question, is there ANY Rust TCP client (or Websocket client) which could run in wasm and connect to a message-io server ? I do not seem to find any ? Tokio etc also don't work in wasm. |
Hi Markus, thanks! The explorers API do not expose the possibility to start TCP/UDP connections directly. If you want to connect to a server you need to do it by WebSocket using the (wasm-bindgen)[https://github.com/rustwasm/wasm-bindgen] or any other higher library that uses it. This is because the wasm applications only have access to OS utilities through the explorer API due to security reasons. So, if you need to connect a wasm application to a message-io server you can only do it by listening to a websocket connection in the server-side. |
Regarding Websocket clients that can connect to message-io, any library that implements WebSocket using the web-sys interfaces can do the job. A minor detail is that the message-io WebSocket adapter uses binary instead of text mode, so from a client library that want to connect to message-io, the messages should be sent as binary. |
Thanks for the answer, this helps a lot! |
Currently, WebSocket is working for client/server side. However, the browsers do not allow to create tcp connections direclty (which is the current implementation based). Instead, the
web-sys
must be used.wasm
.The text was updated successfully, but these errors were encountered: