Hi all,
I'm trying to experiment with async streams in WASI preview2, specifically using this Wasmtime host example as a reference.
Unfortunately, I’ve run into a few roadblocks:
I can't get the example to compile because wasmtime-wasi on crates.io doesn't have the preview2 feature anymore.
Using the GitHub repo versions results in version conflicts or missing features related to preview2.
I also haven’t found any minimal async guest examples in Rust that work with this setup.
Context:
Here’s the core error I keep encountering during cargo fetch:
error: failed to select a version for `wasmtime-wasi`. ... required by package `wasip2-demo` versions that meet the requirements `^8.0.0` are: 8.0.1, 8.0.0 the package depends on `wasmtime-wasi` with features: `preview2` but those features do not exist in those versions.
Attempts to use the GitHub repo as a git dependency lead to:
error: failed to select a version for `wasmtime-wasi`. ... required by package `wasip2-demo` versions that meet the requirements `*` are: 35.0.0 the package depends on `wasmtime-wasi` with features: `preview2` but those features do not exist.
I’m feeling stuck and would appreciate any pointers or links to minimal working examples of:
Async host embedding WASI preview2 (Rust)
Async guest WASI preview2 examples (Rust)
Guidance on correct Cargo.toml dependency setup to avoid these version/feature conflicts
Thanks very much in advance for any help, and apologies if I’ve missed something obvious!
@Yosh Wuyts do your async examples address this?
I think it should cover the Rust guest side, at least: https://github.com/bytecodealliance/sample-wasi-http-rust
Thank you both so much!
async is only implemented for rust currently, is that correct?
JS and C are definitely supported as well right now
For WASIp2 that is
For WASIp3 it is only Rust and C right now
I forget what the state of support is for other languages on p2. I believe tiny Go, C#, and Python may all have support too - but I'm not actually sure. Someone else might know
Here is an async JS sample: https://github.com/bytecodealliance/sample-wasi-http-js
Note also that there are many examples in the Jco repository:
https://github.com/bytecodealliance/jco/tree/main/examples/components
"async" is supported on the host side (via JSPI), thanks to hard work of contributors like Calvin -- but right now work on P3 support for Jco is underway
So right now, all examples target preview2 and it's envisioning of I/O (wasi:io, etc) -- not the new world (stream<t>s, etc)
is it that wit-bindgen doesn't support anything other than rust yet then? I tried using async in C# and it blew up with PlatformNotSupportedException. Perhaps thats a dotnet runtime issue? I'll be honest, wasm, wasi, WIT, WAT, WASI 0.2, 0.3 etc is a lot to keep track of, so apologies if I've got it completely wrong haha
Yup, that's the case -- right now async on the guest side has the best support in Rust -- it's evolved hand-in-hand with the p3-prototyping repo
But if you're new to Wasm + WASI + WIT, WAT, I'd suggest tarting with preview2 and getting some stuff going! :)
Have you seen https://component-model.bytecodealliance.org/ ? Hopefully it's a helpful resource for you -- but you can build stuff on P2 right now, and it is possible to do asynchronous operations (wasi:io et all), it's just a bit more tedious than P3 -- P3 is going to be a huge improvement on many axes
Some talks on this that are a great listen and cover a lot of P2, P3 and motivations:
Victor Adossi said:
But if you're new to Wasm + WASI + WIT, WAT, I'd suggest tarting with preview2 and getting some stuff going! :)
Yeah I've got a guest component and host working, and wac'ing them together (another three letter acronym :sweat_smile:) and running! Its pretty cool
image.png
All the work is in the open and there is a ton of work going on right now being lead by Alex, Joel and others.
Victor Adossi said:
Have you seen https://component-model.bytecodealliance.org/ ? Hopefully it's a helpful resource for you -- but you can build stuff on P2 right now, and it is possible to do asynchronous operations (
wasi:ioet all), it's just a bit more tedious than P3 -- P3 is going to be a huge improvement on many axes
I think I've ended up there, yeah :)
Victor Adossi said:
Some talks on this that are a great listen and cover a lot of P2, P3 and motivations:
https://www.youtube.com/watch?v=mkkYNw8gTQg&list=PLP3xGl7Eb-4OtFH1tcQm6u7_LRED7-3rg&index=31
https://www.youtube.com/watch?v=tAACYA1Mwv4&t=9s&pp=ygUPbHVrZSBjb21wb25lbnRz
Thanks for these!
Awesome! Looks like you're already making great progress -- wac is a somewhat more "advanced" feature than it should be, but it's another hugely underrated bit of the component model -- composability being a huge feature
The last few days I was curious about what the future of browsers could look like - imagine the browser wasm runtime exported a world with an interface for the DOM Apis, and components could use that to update the dom
How cool would that be - no JS! :sweat_smile:
I then spent a longgggg time trying to find if any browser exposes a c api for the DOM, with very little results haha
Oh you might like the excellent work of Mendy and co:
https://github.com/wasi-gfx/webidl2wit
Example in Jco:
https://github.com/bytecodealliance/jco/tree/main/examples/components/webidl-book-library
https://github.com/bytecodealliance/jco/tree/229a8408538cee77aefdfcf834cb8e32bd2d2ebc/packages/jco/test/fixtures/idl
Oh very cool! :)
Last updated: Dec 06 2025 at 05:03 UTC