Stream: rust-toolchain

Topic: Async Runtime state-of-the-art?


view this post on Zulip raskyld (Oct 07 2024 at 16:49):

Hello!

I am in the process of making Leptos (a web framework) capable of targeting wasm32-wasip* for its Server Side Rendering, it's working well (reactivity, streaming the HTML response, server functions, tailwind integration), I have made a stupid abstraction of wasi:http using http and bytes crate so the framework is integrating nicely with WASI.

But I am not satisfied with the current state of the async runtime integration (PR is there if you are interested: https://github.com/leptos-rs/leptos/pull/3063). Obviously, it doesn't use the Pollable of WASI and you can really easily stale the calling stack so I want to build some abstraction to makes it easier for the end-users.

I've read the really good article of @Yoshua Wuyts
https://bytecodealliance.zulipchat.com/#narrow/stream/235408-rust-toolchain/topic/.5Bpost.5D.20Designing.20an.20async.20Runtime.20for.20WASI.200.2E2/near/424106638

And I was wondering if the state of the art evolved ? Is there any other implementation, is the community using https://docs.rs/wasi-async-runtime/latest/wasi_async_runtime/ etc?
I am still evaluating using a crate for that vs. writing my own abstraction etc.

Thanks a lot for any hints! :pray:

DISCLAIMER: This is a draft, I am not a seasoned Rust developer so this PR need some attention to ensure the code is idiomatic and clean. This is a side-project, not backed by my company so I need ...

view this post on Zulip Joel Dice (Oct 08 2024 at 21:01):

Have you looked at https://crates.io/crates/leptos-spin at all? It's experimental, but based on spin-sdk and spin-executor, which are reasonably mature and capable of managing WASI pollables in an async context. Despite being intended for targeting Spin, you should be able to use it to target a generic wasi:http runtime as long as you don't use any of the Spin-specific APIs.

Spin is the open source developer tool for building and running serverless applications powered by WebAssembly. - fermyon/spin

view this post on Zulip raskyld (Oct 10 2024 at 07:21):

Yep I've checked this project and the spin-start one, I am targeting Leptos 0.7 so there was some migration I had to do.
I haven't checked those 2 underlying crates, I will definitely have a check! Thanks a lot :pray:


Last updated: Dec 23 2024 at 14:03 UTC