pub struct ConnectOptions {
pub url: String,
pub headers: HeaderMap,
pub handshake_provider: Option<HandshakeProvider>,
pub metadata: Metadata,
pub reconnect: ReconnectPolicy,
pub handshake_timeout: Duration,
pub connect_timeout: Option<Duration>,
pub initial_messages: InitialMessages,
pub event_history: EventOptions,
pub routing: ResponseRouting,
pub diagnostics: Option<HandshakeDiagnosticOptions>,
}Expand description
URL, handshake, reconnect, and receive settings for a WebSocket session.
Fields§
§url: StringTarget WebSocket URL with a host and ws or wss scheme.
headers: HeaderMapStatic HTTP headers added to each handshake; provider values may override duplicates.
handshake_provider: Option<HandshakeProvider>Provider for dynamic handshake headers and context; None uses static settings only.
metadata: MetadataApplication metadata for local observation and correlation; never sent automatically.
reconnect: ReconnectPolicyRetry policy after connection failure or termination; bounded exponential backoff by default.
handshake_timeout: DurationPer-attempt handshake deadline, including context preparation and network setup (10 s default).
connect_timeout: Option<Duration>Overall deadline from session start to the first successful connection (30 s default).
Retries and waits count toward it; None removes this additional limit.
initial_messages: InitialMessagesWhether to create a buffered initial message inbox when the session starts.
event_history: EventOptionsCount and byte capacity of connection-event history for later replay.
routing: ResponseRoutingStrategy for recognizing and completing pending requests from business messages.
diagnostics: Option<HandshakeDiagnosticOptions>Handshake diagnostic collection and redaction; None disables optional diagnostics.