pub struct WsConfig<T> { /* private fields */ }
Expand description
A Websocket transport.
Implementations§
Source§impl<T> WsConfig<T>
impl<T> WsConfig<T>
Sourcepub fn new(transport: T) -> Self
pub fn new(transport: T) -> Self
Create a new websocket transport based on the given transport.
Sourcepub fn max_redirects(&self) -> u8
pub fn max_redirects(&self) -> u8
Return the configured maximum number of redirects.
Sourcepub fn set_max_redirects(&mut self, max: u8) -> &mut Self
pub fn set_max_redirects(&mut self, max: u8) -> &mut Self
Set max. number of redirects to follow.
Sourcepub fn max_data_size(&self) -> usize
pub fn max_data_size(&self) -> usize
Get the max. frame data size we support.
Sourcepub fn set_max_data_size(&mut self, size: usize) -> &mut Self
pub fn set_max_data_size(&mut self, size: usize) -> &mut Self
Set the max. frame data size we support.
Sourcepub fn set_tls_config(&mut self, c: Config) -> &mut Self
pub fn set_tls_config(&mut self, c: Config) -> &mut Self
Set the TLS configuration if TLS support is desired.
Sourcepub fn use_deflate(&mut self, flag: bool) -> &mut Self
pub fn use_deflate(&mut self, flag: bool) -> &mut Self
Should the deflate extension (RFC 7692) be used if supported?
Trait Implementations§
Source§impl<T> Transport for WsConfig<T>
impl<T> Transport for WsConfig<T>
Source§type Output = RwStreamSink<BytesConnection<<T as Transport>::Output>>
type Output = RwStreamSink<BytesConnection<<T as Transport>::Output>>
The result of a connection setup process, including protocol upgrades. Read more
Source§type Listener = MapStream<Pin<Box<dyn Stream<Item = Result<ListenerEvent<Pin<Box<dyn Future<Output = Result<Connection<<T as Transport>::Output>, Error<<T as Transport>::Error>>> + Send>>, Error<<T as Transport>::Error>>, Error<<T as Transport>::Error>>> + Send>>, fn(Connection<<T as Transport>::Output>, ConnectedPoint) -> RwStreamSink<BytesConnection<<T as Transport>::Output>>>
type Listener = MapStream<Pin<Box<dyn Stream<Item = Result<ListenerEvent<Pin<Box<dyn Future<Output = Result<Connection<<T as Transport>::Output>, Error<<T as Transport>::Error>>> + Send>>, Error<<T as Transport>::Error>>, Error<<T as Transport>::Error>>> + Send>>, fn(Connection<<T as Transport>::Output>, ConnectedPoint) -> RwStreamSink<BytesConnection<<T as Transport>::Output>>>
Source§type ListenerUpgrade = MapFuture<Pin<Box<dyn Future<Output = Result<Connection<<T as Transport>::Output>, Error<<T as Transport>::Error>>> + Send>>, fn(Connection<<T as Transport>::Output>, ConnectedPoint) -> RwStreamSink<BytesConnection<<T as Transport>::Output>>>
type ListenerUpgrade = MapFuture<Pin<Box<dyn Future<Output = Result<Connection<<T as Transport>::Output>, Error<<T as Transport>::Error>>> + Send>>, fn(Connection<<T as Transport>::Output>, ConnectedPoint) -> RwStreamSink<BytesConnection<<T as Transport>::Output>>>
Source§type Dial = MapFuture<Pin<Box<dyn Future<Output = Result<Connection<<T as Transport>::Output>, Error<<T as Transport>::Error>>> + Send>>, fn(Connection<<T as Transport>::Output>, ConnectedPoint) -> RwStreamSink<BytesConnection<<T as Transport>::Output>>>
type Dial = MapFuture<Pin<Box<dyn Future<Output = Result<Connection<<T as Transport>::Output>, Error<<T as Transport>::Error>>> + Send>>, fn(Connection<<T as Transport>::Output>, ConnectedPoint) -> RwStreamSink<BytesConnection<<T as Transport>::Output>>>
Source§fn listen_on(
self,
addr: Multiaddr,
) -> Result<Self::Listener, TransportError<Self::Error>>
fn listen_on( self, addr: Multiaddr, ) -> Result<Self::Listener, TransportError<Self::Error>>
Listens on the given
Multiaddr
, producing a stream of pending, inbound connections
and addresses this transport is listening on (cf. ListenerEvent
). Read moreSource§fn address_translation(
&self,
server: &Multiaddr,
observed: &Multiaddr,
) -> Option<Multiaddr>
fn address_translation( &self, server: &Multiaddr, observed: &Multiaddr, ) -> Option<Multiaddr>
Performs a transport-specific mapping of an address
observed
by
a remote onto a local listen
address to yield an address for
the local node that may be reachable for other peers.Source§fn map<F, O>(self, f: F) -> Map<Self, F>
fn map<F, O>(self, f: F) -> Map<Self, F>
Applies a function on the connections created by the transport.
Source§fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
Applies a function on the errors generated by the futures of the transport.
Source§fn or_transport<U>(self, other: U) -> OrTransport<Self, U>
fn or_transport<U>(self, other: U) -> OrTransport<Self, U>
Adds a fallback transport that is used when encountering errors
while establishing inbound or outbound connections. Read more
Auto Trait Implementations§
impl<T> Freeze for WsConfig<T>where
T: Freeze,
impl<T> !RefUnwindSafe for WsConfig<T>
impl<T> Send for WsConfig<T>where
T: Send,
impl<T> Sync for WsConfig<T>where
T: Sync,
impl<T> Unpin for WsConfig<T>where
T: Unpin,
impl<T> !UnwindSafe for WsConfig<T>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more