Skip to content

wasm-rpc/wasm-rpc-spec

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

WasmRPC

WasmRPC is a standard format for Web Assembly modules that allows them to be run across multiple runtime implementations.

WasmRPC allows you to write the following rust code:

#[export]
fn hello(string: String) -> String {
    let mut new_string = string.clone();
    new_string.insert_str(0, "hello ");
    new_string
}

And call it from JavaScript like this:

import WasmRPC from 'wasm-rpc';

async function run() {
    const hello = new WasmRPC();
    await hello.loadFile('target/wasm32-unknown-unknown/debug/hello.wasm');
    let result = await hello.call("hello", "world");

    console.log(result);
    // -> "hello world"
}
run();

Read the WasmRPC specification here.

About

A standard for interfacing between WebAssembly and WebAssembly runtime environments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published