simolus3 opened PR #14320 from simolus3:serve-unix-sockets to bytecodealliance:main:
This changes
wasmtime serveto add support for
- Listening on multiple sockets:
wasmtime servecurrently serves http requests from a single TCP server. This adds support for multiple server sockets, which is useful to e.g. listen for both ipv4 and ipv6 connections, e.g. withwasmtime serve app.wasm --addr 127.0.0.1:8080 --addr [::1]:8080. Multiple sockets can also be inherited via--systemd-listenfd.- Unix domain sockets. In setups where
wasmtime serveruns behind a reverse proxy, using unix sockets instead of TCP is simpler and likely faster. With this PR, unix sockets can be inherited via--systemd-listenfd. This avoids having to parse both file paths and ip addresses from parameters, but maybe it makes sense to do that as well.Support for multiple sockets is implemented by spawning one task per socket that otherwise runs the existing request loop. To avoid concurrency for debugging setup, that still runs outside of a concurrent task (and thus only supports a single socket).
simolus3 requested dicej for a review on PR #14320.
simolus3 requested wasmtime-core-reviewers for a review on PR #14320.
simolus3 updated PR #14320.
:thumbs_up: dicej submitted PR review:
Thanks, @simolus3!
dicej added PR #14320 wasmtime serve: Support multiple sockets, unix sockets to the merge queue.
github-merge-queue[bot] removed PR #14320 wasmtime serve: Support multiple sockets, unix sockets from the merge queue.
@simolus3 Looks like the Windows builds are failing due to ungated Unix-isms.
simolus3 updated PR #14320.
simolus3 commented on PR #14320:
I didn't know we couldn't do
cfginpin-project-lite, I'm now using this workaround, I also had to markStdSocketServer::Inetas unix-only since it's not constructed on Windows builds, leading to a warning. It's a hard for me to test locally since I don't have access to Windows, but I hope it works now.
simolus3 edited a comment on PR #14320:
I didn't know we couldn't do
cfginpin-project-lite, I'm now using this workaround. I also had to markStdSocketServer::Inetas unix-only since it's not constructed on Windows builds, leading to a warning. It's a hard for me to test locally since I don't have access to Windows, but I hope it works now.
Last updated: Sep 20 2026 at 18:08 UTC