-
Notifications
You must be signed in to change notification settings - Fork 18
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
Possibility of WASM Support? #18
Comments
Yes, it would be pretty cool. |
Awesome! I can't make any guarantees about time I'll have for this, but I think I'll be able to try it out. :) When I get the chance I'll try to see if I can get it to build on web. I'm currently building a game engine that runs on desktop and web so I've been learning about how to make Rust run in web. |
I just started looking into this a little bit and my initial observation is that both disk access and network access are built-in to chamomile and not optional. Also the network transports are hard-coded to UDP, TCP, RTP, and UDT. Here's my initial thought on how we might change this to make it more universal and to make it easier to support web: I'm thinking that we should create two traits:
Using traits for this wouldn't be necessary, but I think it would be great for making the architecture more flexible and allowing it to adapt to more use-cases. What do you think? I haven't gotten deep into this so I could be missing things. |
Yes, you are right. Core problem is
|
Reference, see wasm support in smol. smol-rs/smol#87 |
Perfect. I just compiled
Thanks. I don't think After ensuring that When we should be able to run relay servers that host a websocket port and a normal TCP port to enable hooking web clients up to non-web clients seamlessly. |
A simple send and receive test shows that use wasm_bindgen_futures::spawn_local;
use web_sys::console;
fn main() {
spawn_local(async move {
let (sender, receiver) = async_channel::unbounded();
spawn_local(async move {
for i in 0..=10usize {
console::log_1(&format!("sending: {}", i).into());
sender.send(i).await.ok();
}
});
while let Ok(i) = receiver.recv().await {
console::log_1(&format!("received: {}", i).into());
}
});
} |
Hey there, I just found this and I was wondering what your thoughts on the possibility of WASM support might be. A quick check and attempt at compiling leads me to think that the only thing stopping it so far is its dependency on
async-io
from thesmol
crate.For web we might be able to get away without
smol
by usingwasm-bindgen-futures
and I recently portedasync_lock
to work on web ( it just needed to remove the dependency onstd::instant
) so we might be able to getasync_channel
to work as well ( or it will just work, I haven't tried it.At that point you just have to worry about the transport. You would have to use websockets I think, and peer to peer doesn't really work on web without a signalling server we would have to take that into account to.
Anyway, I literally just found this, but I thought it looked neat and I've wondered about having a Rust library that I could on desktop native and in web to provide peer-to-peer DApps for a while so I thought I'd ask. :)
The text was updated successfully, but these errors were encountered: