wasip3/

directory
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2026 License: Apache-2.0

README

wasip3 Example

This demonstrates how to implement a wasi:http@0.3.0-rc-2025-09-16 handler using Go, based on a new wit-bindgen-go bindings generator which supports idiomatic, goroutine-based concurrency on top of the Component Model concurrency ABI.

As of this writing, not everything has been upstreamed and released, so this relies on specific Git revisions of certain tools, plus a patched version of Go. Once everything is merged, we'll be able to switch to the upstream releases.

Building and Running

Prerequisites

This will build the dependencies, generate Go bindings from the wasi:http@0.3.0-rc-2025-09-16 WIT files, build the component, and run it using wasmtime serve:

make run

While that's running, you can send a request from another shell:

curl -i http://127.0.0.1:8080/hello

If all goes well, you should see hello, world!.

You can also try the other endpoints, e.g. /echo, which does full-duplex streaming:

curl -i -H 'content-type: text/plain' --data-binary @- http://127.0.0.1:8080/echo <<EOF
’Twas brillig, and the slithy toves
      Did gyre and gimble in the wabe:
All mimsy were the borogoves,
      And the mome raths outgrabe.
EOF

...and /hash-all, which concurrently downloads one or more URLs and streams the SHA-256 hashes of their contents:

curl -i \
    -H 'url: https://webassembly.github.io/spec/core/' \
    -H 'url: https://www.w3.org/groups/wg/wasm/' \
    -H 'url: https://bytecodealliance.org/' \
    http://127.0.0.1:8080/hash-all

Note

This was originally built by @dicej and has been adapted from the original example to use componentize-go.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL