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,
) -> WebSocketTransportConfig
pub const fn with_request_timeout( self, timeout: Duration, ) -> WebSocketTransportConfig
Sets the request timeout.
Sourcepub const fn with_connect_timeout(
self,
timeout: Duration,
) -> WebSocketTransportConfig
pub const fn with_connect_timeout( self, timeout: Duration, ) -> WebSocketTransportConfig
Sets how long the connect may take, handshake included.
Sourcepub fn with_extra_headers(
self,
headers: HashMap<String, String>,
) -> WebSocketTransportConfig
pub fn with_extra_headers( self, headers: HashMap<String, String>, ) -> WebSocketTransportConfig
Sets extra HTTP headers for the upgrade request.
Sourcepub const fn with_max_message_size(
self,
max_bytes: usize,
) -> WebSocketTransportConfig
pub const fn with_max_message_size( self, max_bytes: usize, ) -> WebSocketTransportConfig
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
Source§impl Default for WebSocketTransportConfig
impl Default for WebSocketTransportConfig
Source§fn default() -> WebSocketTransportConfig
fn default() -> 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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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