Comments (2)
Thanks, that clears it up.
WAGI is definitely a sensible approach, especially since it doesn't need any special API surface.
Although interface types and a specialized interface would probably be preferable in the long term.
Anyway, thanks for the comprehensive response!
from wasi-experimental-http.
Thanks a lot for opening this issue!
The main reason we don't really want to delve into building support for listeners and servers is the lack of multi-threading in WebAssembly (or to be more exact, the current lack of a spec for multi-threading and implementations outside the browser, since Emscripten does handle thread creation in the browser through web workers).
We could definitely do something similar to what you are describing, but we would immediately hit the single-threaded nature of Wasm modules, so real-world functionality would be rather limited (I did briefly discuss this in a past article as well).
So instead, we are building WAGI, which does exactly that - start a web server outside the Wasm runtime, but instantiate a new module for each request instead, leveraging the underlying runtime's multi-threadedness.
Request bodies are read through standard input, and response bodies through standard output - hence the "GI" part of the name, coming from CGI.
We're trying to make this as un-opinionated as possible, and we recently added support for this library, meaning guest modules can now make outbound HTTP requests.
For now, until multi-threading and networking are real things in WASI spec, WAGI seems to fill this spot quite well.
Here is a draft article that describes the current state of development for WAGI, which briefly details the HTTP support, as well as a few other features.
(other platforms that tackle the issue of passing request data to WebAssembly modules are wasmCloud and Suborbital Atmo, you might want to take a look at their application models as well).
I hope this starts to answer your question - feel free to free to continue the discussion here, or over in the WAGI repo is you have specific questions about it.
from wasi-experimental-http.
Related Issues (20)
- Support wasmtime 4.0
- unknown import: `wasi_experimental_http::req` has not been defined
- Options HOT 1
- AssemblyScript: GC finalizer for `Response` HOT 8
- AssemblyScript: `Console.log` of string literal panics HOT 2
- Implement host call to get all headers
- Add a simple binary that can be used for standalone testing modules
- Failing tests related to allowed hosts in AssemblyScript HOT 2
- Destination not allowed"
- "Destination not allowed" errors are non-descriptive
- Compiling anything that imports `wasi_experimental_http_wasmtime` fails on Windows HOT 1
- Update Wasmtime to v0.28
- Explore re-building on top of WITX2 and `witx-bindgen`
- Automate package publishing
- HTTP endpoint used in tests changed
- Check origin as opposed to only the host
- Add TinyGo client implementation HOT 1
- Update `as-wasi` dependency in AssemblyScript client HOT 1
- Cargo.toml wasi-experimental-http and wasi-experimental-http-wasmtime dependencies: crates.io vs local path?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasi-experimental-http.