Struct ntex::ws::WsClientBuilder
source ·
[−]pub struct WsClientBuilder<F, T> { /* fields omitted */ }
Expand description
WebSocket
client builder
Implementations
impl<F, T> WsClientBuilder<F, T> where
T: Service<Connect<Uri>, Response = Io<F>, Error = ConnectError>,
impl<F, T> WsClientBuilder<F, T> where
T: Service<Connect<Uri>, Response = Io<F>, Error = ConnectError>,
Set socket address of the server.
This address is used for connection. If address is not provided url’s host name get resolved.
Set supported websocket protocols
Set a cookie
Set request Origin
Set max frame size
By default max size is set to 64kb
Disable payload masking. By default ws client masks frame payload.
pub fn header<K, V>(&mut self, key: K, value: V) -> &mut Self where
HeaderName: TryFrom<K>,
HeaderValue: TryFrom<V>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
<HeaderValue as TryFrom<V>>::Error: Into<HttpError>,
pub fn header<K, V>(&mut self, key: K, value: V) -> &mut Self where
HeaderName: TryFrom<K>,
HeaderValue: TryFrom<V>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
<HeaderValue as TryFrom<V>>::Error: Into<HttpError>,
Append a header.
Header gets appended to existing header.
To override header use set_header()
method.
pub fn set_header<K, V>(&mut self, key: K, value: V) -> &mut Self where
HeaderName: TryFrom<K>,
HeaderValue: TryFrom<V>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
<HeaderValue as TryFrom<V>>::Error: Into<HttpError>,
pub fn set_header<K, V>(&mut self, key: K, value: V) -> &mut Self where
HeaderName: TryFrom<K>,
HeaderValue: TryFrom<V>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
<HeaderValue as TryFrom<V>>::Error: Into<HttpError>,
Insert a header, replaces existing header.
pub fn set_header_if_none<K, V>(&mut self, key: K, value: V) -> &mut Self where
HeaderName: TryFrom<K>,
HeaderValue: TryFrom<V>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
<HeaderValue as TryFrom<V>>::Error: Into<HttpError>,
pub fn set_header_if_none<K, V>(&mut self, key: K, value: V) -> &mut Self where
HeaderName: TryFrom<K>,
HeaderValue: TryFrom<V>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
<HeaderValue as TryFrom<V>>::Error: Into<HttpError>,
Insert a header only if it is not yet set.
Set HTTP basic authorization header
Set HTTP bearer authentication header
Set request timeout.
Request timeout is the total time before a response must be received. Default value is 5 seconds.
pub fn connector<F1, T1>(&mut self, connector: T1) -> WsClientBuilder<F1, T1> where
F1: Filter,
T1: Service<Connect<Uri>, Response = Io<F1>, Error = ConnectError>,
pub fn connector<F1, T1>(&mut self, connector: T1) -> WsClientBuilder<F1, T1> where
F1: Filter,
T1: Service<Connect<Uri>, Response = Io<F1>, Error = ConnectError>,
Use custom connector
pub fn openssl(
&mut self,
connector: SslConnector
) -> WsClientBuilder<SslFilter, Connector<Uri>>
pub fn openssl(
&mut self,
connector: SslConnector
) -> WsClientBuilder<SslFilter, Connector<Uri>>
Use openssl connector.
pub fn rustls(
&mut self,
config: Arc<ClientConfig>
) -> WsClientBuilder<TlsFilter, Connector<Uri>>
pub fn rustls(
&mut self,
config: Arc<ClientConfig>
) -> WsClientBuilder<TlsFilter, Connector<Uri>>
Use rustls connector.
This method construct new WsClientBuilder
Complete building process and construct websockets client.
Trait Implementations
Auto Trait Implementations
impl<F, T> !RefUnwindSafe for WsClientBuilder<F, T>
impl<F, T> !Send for WsClientBuilder<F, T>
impl<F, T> !Sync for WsClientBuilder<F, T>
impl<F, T> Unpin for WsClientBuilder<F, T> where
F: Unpin,
T: Unpin,
impl<F, T> !UnwindSafe for WsClientBuilder<F, T>
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more