Skip to main content

Module ws_connect

Module ws_connect 

Source
Expand description

Opens a WebSocket like connect_async_tls_with_config, but through the HTTP proxy named by HTTPS_PROXY (HTTP_PROXY for ws://, then ALL_PROXY) when there is one, honouring NO_PROXY. The proxy only carries bytes: we send CONNECT host:port, and the TLS handshake then runs over the tunnel against the real host, so the server name and the certificate checks are the host’s, never the proxy’s. srv’s HTTP clients read the same variables (reqwest); this makes the live MuxBus connection behave the same, and lets the fault proxy of scripts/net-fault take it down (SPEC_OFFLINE_RESILIENCE_2026_10_20.md §7.1).

Fail closed: when a proxy is configured and cannot be used (its address is not http://, it refuses the CONNECT, it does not answer) the connect fails, as a connect that cannot reach the network does; it never goes direct. Credentials in the proxy address (user:pass@) are sent as Proxy-Authorization and never logged or put in an error.

Functions§

connect
Connects the WebSocket for request, through the environment’s proxy when it names one for the request’s host.