smol-rs / async-channel

Async multi-producer multi-consumer channel
Apache License 2.0
769 stars 39 forks source link

This crate works with WebAssembly (WASM) 🚀 #61

Closed austintheriot closed 1 year ago

austintheriot commented 1 year ago

Hello! Not an issue here per-se, but for those looking for an async channels crate that works with wasm (a niche community I'm sure), I just wanted to flag that this one does! I'm not sure if support here is intentional--since it's not mentioned in the docs, I have to assume it's unintentional, but, regardless, it's certainly appreciated.

I tried std and crossbeam, which, in general, are not appropriate for wasm, since to do anything useful most of the time, you have to block the main thread (which actually causes a panic at runtime), I then tried tokio, which fails to compile at all for wasm. However, I added this dependency, and it worked right out of the box! Thanks for your work creating this crate.

notgull commented 1 year ago

No problem! My goal is that the non-I/O crates in this organization should work automatically with WASM. Any crates that aren't compatible OOTB with WASM should have an issue raised.