Stream: general

Topic: Async: WASI and Wasm


view this post on Zulip logical (Mar 07 2022 at 16:17):

Hi, I noticed this message on the WASI repo: "Proposals that require async/streams are expected to be unblocked in early Q2 2022" (https://github.com/WebAssembly/WASI). However, I did not find any mention of async on the Wasm side of the project. Is async going to be added to both Webassembly in the browser and WASI, or just WASI?

WebAssembly System Interface. Contribute to WebAssembly/WASI development by creating an account on GitHub.

view this post on Zulip Till Schneidereit (Mar 09 2022 at 12:04):

hi @logical there's ongoing work to add async support to the component model. WASI will be specified in terms of the component model and through that gain support for async. Browsers will get this support through implementing the component model if they choose to do so.

That said, browsers can already support async calls, as for example in rust-wasm's guide for working with Rust Futures and JS Promises.

Repository for design and specification of the Component Model - GitHub - WebAssembly/component-model: Repository for design and specification of the Component Model

view this post on Zulip logical (Mar 10 2022 at 02:24):

@Till Schneidereit

Oh wow. So, if I understand you correctly, WASI might become the standard for all of WebAssembly? In other words, each platform, for example, the browser, or the PC, could implement the pieces of the WASI component model for their own runtime requirements? That makes sense, since the browser is potentially just another app running on top of WASI anyway. I'm also guessing that this will mean that browsers like Chrome and Firefox would need to be fundamentally refactored if they chooses to go this route?

Anyways, was this WebAssembly's original roadmap? Or is this new "unified" approach a recent decision?

view this post on Zulip Till Schneidereit (Mar 10 2022 at 08:56):

WASI and the component model are two different things, and browsers might implement the component model, but not any parts of WASI, or some WASI proposals that make sense in their context.

One key aspect of the component model is that it's fully virtualizable: all component model APIs can be implemented in-content with other components. That means that any parts of a component-model based WASI can be polyfilled in browsers until such a time when browsers might add native support.

But to get back to your initial question: as described in the rust-wasm link I shared it's possible today to use async with Wasm, but the component model has such support deeply built in


Last updated: Dec 23 2024 at 12:05 UTC