GithubHelp home page GithubHelp logo

Comments (2)

theduke avatar theduke commented on May 31, 2024 1

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.

radu-matei avatar radu-matei commented on May 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.