HeadlinesBriefing favicon HeadlinesBriefing.com

WASI 0.3.0 Brings Native Async Support to WebAssembly Components

Hacker News •
×

The WebAssembly Foundation's WASI Subgroup ratified WASI 0.3.0, making async a native feature of WebAssembly Components. This release rebases WASI onto the Component Model's async primitives, eliminating the workarounds required in WASI 0.2. The changes simplify how developers handle asynchronous operations across I/O, networking, and HTTP interfaces.

WASI 0.2's `wasi:io` package used start-finish patterns and pollable resources to simulate async behavior. WASI 0.3.0 replaces these with proper async functions that return futures. For example, stdout now takes a `stream<u8>` parameter and returns a `future<result<_, error-code>>` instead of handing out output-streams. The direction flip reflects a more ergonomic async model where operations complete with results rather than requiring imperative writes.

Network access underwent significant simplification in `wasi:sockets`. The network capability resource disappeared entirely, replaced by world imports for access control. Start-bind/finish-bind pairs collapsed into single `async func` calls, removing intermediate states and the subscribe() mechanism. Similarly, `wasi:http` resources dropped from 8 to 2 - just request and response - with bodies as direct `stream<u8>` types.

`wasi:filesystem` adopted the same stream-plus-future pattern for reads and writes, while directory iteration shifted from resource-based iterators to streams. Clock naming changes standardized `wall-clock` to `system-clock` and `datetime` to `instant` for consistency with POSIX and Rust conventions. These mechanical updates streamline the entire system for better developer experience.