feat(gio): implement POSIX sockets proxy for WASM networking #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add WebSocket-based POSIX sockets proxy client to enable TCP/HTTP connectivity in WASM builds via Cloudflare Workers backend.
Architecture
Changes
New Files:
gio/gposixsocketsproxy.h: Proxy client API declarations
gio/gposixsocketsproxy.c: WebSocket client with binary protocol (1335 lines)
gio/tests/gio-proxy-test.c: Integration tests (322 lines)
Modified Files:
gio/gsocket.c: Integrated proxy into GSocket operations (114 lines)
gio/meson.build: Add proxy sources for Emscripten builds
deno.json: Add test:proxy and test:proxy:local tasks
Protocol
Binary protocol with little-endian encoding, 19 message types matching Emscripten's POSIX sockets proxy specification:
Configuration
Set proxy URL via environment variable:
Defaults to wss://posix-proxy.discere.cloud/v1 if not set.
Testing
Benefits
Impact
Enables TCP/HTTP connectivity for all GIO-based applications compiled to WASM, unlocking network-dependent features like HTTP clients, WebSocket connections, and remote API access.