pub struct WsConnect { /* private fields */ }ws-base only.Expand description
Simple connection details for a websocket connection.
Implementations§
Source§impl WsConnect
impl WsConnect
Sourcepub fn new<S>(url: S) -> WsConnect
pub fn new<S>(url: S) -> WsConnect
Creates a new websocket connection configuration.
If the URL contains credentials (e.g. wss://user:pass@host), they are
automatically extracted and set as the Authorization header.
Sourcepub fn with_auth(self, auth: Authorization) -> WsConnect
pub fn with_auth(self, auth: Authorization) -> WsConnect
Sets the authorization header.
Sourcepub fn with_auth_opt(self, auth: Option<Authorization>) -> WsConnect
pub fn with_auth_opt(self, auth: Option<Authorization>) -> WsConnect
Sets the optional authorization header.
This replaces the current Authorization.
Sourcepub const fn with_config(self, config: WebSocketConfig) -> WsConnect
pub const fn with_config(self, config: WebSocketConfig) -> WsConnect
Sets the websocket config.
Sourcepub const fn auth(&self) -> Option<&Authorization>
pub const fn auth(&self) -> Option<&Authorization>
Get the authorization header.
Sourcepub const fn config(&self) -> Option<&WebSocketConfig>
pub const fn config(&self) -> Option<&WebSocketConfig>
Get the websocket config.
Sourcepub const fn with_max_retries(self, max_retries: u32) -> WsConnect
pub const fn with_max_retries(self, max_retries: u32) -> WsConnect
Sets the max number of retries before failing and exiting the connection. Default is 10.
Sourcepub const fn with_retry_interval(self, retry_interval: Duration) -> WsConnect
pub const fn with_retry_interval(self, retry_interval: Duration) -> WsConnect
Sets the base interval between retries.
Reconnect retries use capped exponential backoff from this base interval. Default is 3 seconds.
Sourcepub const fn with_keepalive_interval(
self,
keepalive_interval: Duration,
) -> WsConnect
pub const fn with_keepalive_interval( self, keepalive_interval: Duration, ) -> WsConnect
Sets the keepalive ping interval.
A ping is sent if no other messages have been sent within this interval. If the server does not respond with a pong before the next ping is due, the connection is considered dead and will be closed.
Default is 10 seconds.
Trait Implementations§
Source§impl IntoClientRequest for WsConnect
impl IntoClientRequest for WsConnect
Source§impl PubSubConnect for WsConnect
impl PubSubConnect for WsConnect
Source§async fn connect(
&self,
) -> Result<ConnectionHandle, RpcError<TransportErrorKind>>
async fn connect( &self, ) -> Result<ConnectionHandle, RpcError<TransportErrorKind>>
Source§fn try_reconnect(
&self,
) -> impl Send + Future<Output = Result<ConnectionHandle, RpcError<TransportErrorKind>>>
fn try_reconnect( &self, ) -> impl Send + Future<Output = Result<ConnectionHandle, RpcError<TransportErrorKind>>>
Source§fn into_service(
self,
) -> impl Send + Future<Output = Result<PubSubFrontend, RpcError<TransportErrorKind>>>
fn into_service( self, ) -> impl Send + Future<Output = Result<PubSubFrontend, RpcError<TransportErrorKind>>>
Auto Trait Implementations§
impl Freeze for WsConnect
impl RefUnwindSafe for WsConnect
impl Send for WsConnect
impl Sync for WsConnect
impl Unpin for WsConnect
impl UnsafeUnpin for WsConnect
impl UnwindSafe for WsConnect
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> 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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 160 bytes