Open dshemin opened 1 month ago
I haven't used wazero
a ton but I have worked with HTTP with wasm/wasi a fair amount.
I would suggest taking a look at wasip2 support that was added and wasi-http.
I played around with implementing a custom HTTP transport here https://github.com/hayride-dev/wasi/blob/main/http/transport/transport.go
and you can see how it was used to do an http.client request here https://github.com/hayride-dev/wasi-tinygo/blob/main/main.go
This uses a lot of wasip2 elements, but it is possible to do similar flows in wasip1. I am working on cleaning up the bindings and will be releasing server handler support and client request support here soon.
In my experience, it does involve creating a custom HTTP transport that can do the translation from host ( wazero env ) to guest ( wasm module/component ) or vice versa
I would recommend taking a look at https://extism.org/docs/concepts/runtime-apis ( which if I recall correctly uses wazero ) and if you are looking at wasip2 checking out wasmtime.
Unfortunately, their Golang bindings do not support wasip2 yet tho so you would need to use Rust as your host and deploy a tinygo component that makes an HTTP client request.
Hi!
I try to make a http request from WASM module running on wazero and got an error^
I try to use netdev package but can't find any suitable examples. Can someone tell me is it possible or not?
My module:
This module I build with this command:
My tingo version is 0.33.0