Stream: wasi

Topic: Extend an existing wasm32-unknown-unknown module with http


view this post on Zulip Manu Schiller (Apr 23 2023 at 13:16):

Hi,
After KubeCon I got to fiddle around with the decision engine OPA. It is available as go binary and as wasm32-unknown-unknown wasm module. The Go binary offers the capability to send http requests via http.send.

In the wasm module the capability is not implemented.
The wasm module can be extended by host functions (https://github.com/open-policy-agent/npm-opa-wasm/blob/main/test/opa-custom-builtins.test.js#L47), but right now it is impossible to have async functions like Javascript Promises.

If I got the wasm component model right, it should be possible to:

Is that on a high level correct?

An open source, general-purpose policy engine. Contribute to open-policy-agent/opa development by creating an account on GitHub.
Open Policy Agent WebAssembly NPM module (opa-wasm) - npm-opa-wasm/opa-custom-builtins.test.js at main · open-policy-agent/npm-opa-wasm

view this post on Zulip Bailey Hayes (Apr 24 2023 at 15:52):

For async behavior, the typical solution is to have host functions implemented with callbacks.

Longer term, I'd expect OPA to support wasi and the outgoing-handler interface of wasi-http.

Contribute to WebAssembly/wasi-http development by creating an account on GitHub.

Last updated: Nov 22 2024 at 16:03 UTC