#[non_exhaustive]pub struct WebSocketOptions<'a> {
pub bearer: Option<&'a str>,
pub max_message_bytes: Option<usize>,
pub policy: Option<&'a TlsPolicy>,
pub allow_insecure_bearer: bool,
}tokio only.Expand description
How to open a WebSocket.
The one setting that is not a URL is the size cap, and it is here because it has to be
applied at the handshake: a frame is fully buffered by the WebSocket library before any
of this crate sees it, so a cap enforced afterwards by codec bounds
what is parsed and not what is held. Left alone it is
DecodeOptions::DEFAULT_MAX_BYTES —
the same mebibyte the codec and the session engines use, so the default configuration
is bounded end to end. Raise both together or neither.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.bearer: Option<&'a str>The bearer token, which under S2 Connect is the websocketToken.
max_message_bytes: Option<usize>The largest frame the transport will buffer. None is the codec’s own default.
policy: Option<&'a TlsPolicy>How to authenticate the server’s certificate. None is
TlsPolicy::Web, the public PKI.
allow_insecure_bearer: boolSend the bearer over plaintext ws://. Off: a bearer is an S2 Connect
communication token, and S2C §Encrypted connection says “S2 MUST NOT be sent
over unencrypted channels”. A bare-WebSocket peer with no bearer is unaffected.
Implementations§
Source§impl<'a> WebSocketOptions<'a>
impl<'a> WebSocketOptions<'a>
Sourcepub const fn allow_insecure_bearer(self) -> Self
pub const fn allow_insecure_bearer(self) -> Self
Permit a bearer over ws:// — for a loopback test and nothing else.
Sourcepub const fn max_message_bytes(self, bytes: usize) -> Self
pub const fn max_message_bytes(self, bytes: usize) -> Self
Buffer no frame larger than this.