pub struct WebSocketTransportConfig {
pub request_timeout: Duration,
pub extra_headers: HashMap<String, String>,
pub connect_timeout: Duration,
pub max_message_size: usize,
}Expand description
Configuration for WebSocketTransport::connect_with_config.
Fields§
§request_timeout: DurationTimeout for unary responses and for the first frame of a stream. Default: 30 seconds.
extra_headers: HashMap<String, String>Extra HTTP headers for the WebSocket upgrade request (e.g. an
Authorization header produced by an
AuthInterceptor).
connect_timeout: DurationHow long the connect may take: TCP, TLS, and the HTTP upgrade handshake, together. Default: 10 seconds.
Nothing bounded this. connect_async_with_config was awaited bare, and
no OS timeout covers an upgrade that is answered late or never — a
server that accepts the TCP connection and then goes silent held the
caller forever. Measured against such a server: still pending at 3
seconds, with no deadline to reach.
Every sibling transport already bounded this — JSON-RPC and REST
through ClientConfig::connection_timeout, gRPC through
GrpcTransportConfig::connect_timeout — and this default matches
theirs. ClientConfig::connection_timeout cannot reach here: this
transport is built directly and handed to with_custom_transport, so
it never sees a ClientConfig.
max_message_size: usizeMaximum size of an incoming WebSocket message, in bytes, enforced at the protocol level during the read. Default: 32 MiB, replacing tungstenite’s 64 MiB default.
That default is
DEFAULT_MAX_RESPONSE_SIZE,
the same constant the HTTP and gRPC transports start from — the same
value, not the same setting. This transport is reached through
with_custom_transport,
so it never sees a ClientConfig and
max_response_size does not reach it. The two agree until somebody
changes one, and the person who tightens a limit is the person who
decided the default was wrong for them. Set the bound here.
Implementations§
Source§impl WebSocketTransportConfig
impl WebSocketTransportConfig
Sourcepub const fn with_request_timeout(self, timeout: Duration) -> Self
pub const fn with_request_timeout(self, timeout: Duration) -> Self
Sets the request timeout.
Sourcepub const fn with_connect_timeout(self, timeout: Duration) -> Self
pub const fn with_connect_timeout(self, timeout: Duration) -> Self
Sets how long the connect may take, handshake included.
Sourcepub fn with_extra_headers(self, headers: HashMap<String, String>) -> Self
pub fn with_extra_headers(self, headers: HashMap<String, String>) -> Self
Sets extra HTTP headers for the upgrade request.
Sourcepub const fn with_max_message_size(self, max_bytes: usize) -> Self
pub const fn with_max_message_size(self, max_bytes: usize) -> Self
Sets the maximum incoming message size in bytes.
Trait Implementations§
Source§impl Clone for WebSocketTransportConfig
impl Clone for WebSocketTransportConfig
Source§fn clone(&self) -> WebSocketTransportConfig
fn clone(&self) -> WebSocketTransportConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WebSocketTransportConfig
impl Debug for WebSocketTransportConfig
Auto Trait Implementations§
impl Freeze for WebSocketTransportConfig
impl RefUnwindSafe for WebSocketTransportConfig
impl Send for WebSocketTransportConfig
impl Sync for WebSocketTransportConfig
impl Unpin for WebSocketTransportConfig
impl UnsafeUnpin for WebSocketTransportConfig
impl UnwindSafe for WebSocketTransportConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request