Tested with Rust 1.93.0, wstd examples v0.6.5, Wasmtime v41.0.3.
-
Open this repo in devcontainer, e.g. using Github Codespaces. Type or copy/paste following commands to devcontainer's terminal.
-
Install WASI Preview 2 build target into Rust toolchain:
rustup target add wasm32-wasip2cdinto the folder of this example:
cd wasip2-sockets-wstd- Clone the wstd repo:
git clone --depth=1 https://github.com/bytecodealliance/wstd.gitcdinto the folder of wstd:
cd wstd- Add http-enabled example to
examplesfolder:
cp ../tcp_stream_http_client.rs ./examples/- Compile all the examples:
cargo build --release --examples -p wstd --target wasm32-wasip2- Install Wasmtime:
curl https://wasmtime.dev/install.sh -sSf | bash- Run Wasmtime with bunch of network-related plugins enabled against just-compiled raw-socket-based HTTP Client example:
~/.wasmtime/bin/wasmtime run -S inherit-network -S allow-ip-name-lookup target/wasm32-wasip2/*/examples/tcp_stream_http_client.wasm- See the results in terminal.
Perform your own experiments if desired.