14 breaking releases

0.15.0 Oct 9, 2023
0.13.0 Aug 17, 2023
0.12.0 Jul 26, 2023
0.6.0 Mar 22, 2023

#1086 in WebAssembly

Apache-2.0

165KB
3.5K SLoC

WasmRS

WasmRS implements reactive streams in WebAssembly modules to enable asynchronous, bidirectional communication in and out of wasm. WasmRS is a spiritual successor to waPC and dramatically expands on what you can do with WebAssembly.

wasmRS Protocol

WasmRS revolves around a handful of methods that allow the host and the guest to write RSocket frames to their respective buffers in WebAssembly memory. The language-specific implementation largely handles the encoding and decoding of these frames with a light UX layer on top and metadata extensions that are relevant to WebAssembly usage.

As in RSocket, wasmRS frames contain a stream ID allowing the destination to differentiate multiple frames for different transactions.

For more information on the protocol, see the wasmRS documentation at the root of this project.

Prerequisites

Building & Running tests

The host tests depend on built WebAssembly modules. To build new modules, run the following:

$ just wasm

Build debug versions of the WebAssembly modules (with wasi) using:

$ just debug

Run tests with the command just test:

$ just test

Running example host with guest wasm

The request binary allows you to make simple requests into WebAssembly binaries, passing JSONified data as input, e.g.:

$ cargo run --bin request -- ./build/reqres_component.wasm suite.test reverse '{"input":"abcdefghijklmnopqrstuvwxyz"}'

Enable trace logging

RUST_LOG=wasmrs=trace cargo run --bin request ...

See also

  • nanobus as a way to run wasmRS modules
  • apex to generate wasmrs boilerplate and scaffold projects using wasmrs.

Contributing

See CONTRIBUTING.md

License

See the root LICENSE.txt

Dependencies

~21–35MB
~543K SLoC