Explicit run-server needed? #819
Copy link
Copy link
Open
Labels
P-httpProposal: wasi-httpProposal: wasi-httpS-inactiveStatus: no discussion in over a year. Records silence during triage; not a proposal to close.Status: no discussion in over a year. Records silence during triage; not a proposal to close.
Description
While there is a method for handling web requests, there's no explicit method for starting a web server.
I don't know if we want to make this part of the interface, or we want to assume that there is a configured server that wraps this WASI module, but it seemed worth mentioning/asking.
cc @lukewagner
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P-httpProposal: wasi-httpProposal: wasi-httpS-inactiveStatus: no discussion in over a year. Records silence during triage; not a proposal to close.Status: no discussion in over a year. Records silence during triage; not a proposal to close.
Activity
lukewagner commentedon Mar 27, 2023
Definitely a good question to ask. As is, the
wasi:http/proxyworld design assumes that the starting of the server is in the host. This matches the original proxy-wasm proposal from which this proposal is derived and is an important characteristic for many of the intended embeddings of thewasi:http/proxyworld. I can write up a PR to mention this as a high-level design choice in README.md.brendandburns commentedon Mar 29, 2023
I guess the question that I have is how do I activate the HTTP client side of the world without also activating the HTTP serving side of the world?
I could definitely do that in the host with a flag, but it feels a little weird that you could load a module that expects to be called to serve HTTP requests, but the host doesn't enable it, it feels like that should explicitly fail, rather than silently not work, but I'm not certain.
brendandburns commentedon Mar 29, 2023
Should there at least be a method in the world that is something like
wants_http_serving()or something like that?lukewagner commentedon Mar 29, 2023
Ah, great question. I think a good way to express that is to define a distinct
worldthat exports the interface that the guest code does expect to be called through. E.g., the wasi-cli proposal could define a world:(assuming we factor out the
cli.maininterface from thecommandworld). Guest code targeting this world would then only export themaininterface instead of theoutgoing-handlerinterface. A host could support one or the other worlds but could also support both worlds by reflecting on the deployed component to see whether themainorincoming-handlerinterface was exported (inspecting theidsubfield of the export names).autodidaddict commentedon May 16, 2023
My 2 🪙:
I typically view components as pieces that sit inside hosts, and I feel like the act of starting a server is the responsibility of the host in which a component resides. The host knows what port number to use, what CORS settings to have, what TLS termination there should be, etc.. these details are ones that I typically try and keep out of a wasm module. If a component can start its own server, it now has to be responsible for all of that configuration and networking baggage that we want the host to handle for us.
It also makes it harder for an HTTP request handler to work in both serverless and microservice style deployments, where the former might be multiplexing or proxying requests in a way opaque to the component.
In other words, in my ideal world, a component is concerned with what is inside the request and what to respond with, but not with how that request arrived or how the response will be delivered.