41 stable releases (12 major)
new 21.0.1 | May 22, 2024 |
---|---|
20.0.2 | May 7, 2024 |
19.0.2 | Apr 11, 2024 |
19.0.0 | Mar 20, 2024 |
9.0.4 | Jun 13, 2023 |
#1138 in WebAssembly
20,381 downloads per month
Used in 15 crates
(9 directly)
3MB
49K
SLoC
Wasmtime's WASI HTTP Implementation
This crate's implementation is primarily built on top of hyper
.
WASI HTTP Interfaces
This crate contains implementations of the following interfaces:
wasi:http/incoming-handler
wasi:http/outgoing-handler
wasi:http/types
The crate also contains an implementation of the wasi:http/proxy
world.
All traits are implemented in terms of a WasiHttpView
trait which provides
basic access to WasiHttpCtx
, configuration for WASI HTTP, and a wasmtime_wasi::ResourceTable
,
the state for all host-defined component model resources.
Examples
Usage of this crate is done through a few steps to get everything hooked up:
- First implement
WasiHttpView
for your type which is theT
inwasmtime::Store<T>
. - Add WASI HTTP interfaces to a
wasmtime::component::Linker<T>
. This is either done through functions likeproxy::add_to_linker
(which bundles all interfaces in thewasi:http/proxy
world together) or through individual interfaces like thebindings::http::outgoing_handler::add_to_linker_get_host
function. - Use the previous
wasmtime::component::Linker<T>::instantiate
to instantiate awasmtime::component::Component
within awasmtime::Store<T>
. If you're targeting thewasi:http/proxy
world, you can instantiate the component withproxy::Proxy::instantiate_async
orproxy::sync::Proxy::instantiate
functions.
Dependencies
~27–41MB
~806K SLoC