Skip to main content

connect_ws_allow_plaintext

Function connect_ws_allow_plaintext 

Source
pub async fn connect_ws_allow_plaintext(
    ws_url: &str,
    auth_header: Option<AuthHeader<'_>>,
    max_message_bytes: usize,
) -> Result<WsSession, ClientError>
Expand description

Establish a WebSocket connection that also accepts plaintext ws://.

Explicit opt-in for local test rigs and examples that run without TLS. Production code must use connect_ws / connect_ws_with_limit, which accept only wss:// (jmap-chat-wss-guide.md: “clients MUST reject any URL that does not begin with wss:// rather than downgrading the connection”). Otherwise identical to connect_ws_with_limit.

§Security

A ws:// connection carries auth_header and every frame in cleartext. Never pass a URL taken from an untrusted session document.