pub struct Client { /* private fields */ }
Expand description
WebSocket
client
Example of WebSocket
client usage is available in
websocket example
Implementations
sourceimpl Client
impl Client
sourcepub fn with_connector<S: AsRef<str>>(
uri: S,
conn: Addr<ClientConnector>
) -> Client
pub fn with_connector<S: AsRef<str>>(
uri: S,
conn: Addr<ClientConnector>
) -> Client
Create new websocket connection with custom ClientConnector
sourcepub fn protocols<U, V>(self, protos: U) -> Selfwhere
U: IntoIterator<Item = V> + 'static,
V: AsRef<str>,
pub fn protocols<U, V>(self, protos: U) -> Selfwhere
U: IntoIterator<Item = V> + 'static,
V: AsRef<str>,
Set supported websocket protocols
Set cookie for handshake request
sourcepub fn origin<V>(self, origin: V) -> Selfwhere
HeaderValue: HttpTryFrom<V>,
pub fn origin<V>(self, origin: V) -> Selfwhere
HeaderValue: HttpTryFrom<V>,
Set request Origin
sourcepub fn max_frame_size(self, size: usize) -> Self
pub fn max_frame_size(self, size: usize) -> Self
Set max frame size
By default max size is set to 64kb
sourcepub fn write_buffer_capacity(self, cap: usize) -> Self
pub fn write_buffer_capacity(self, cap: usize) -> Self
Set write buffer capacity
Default buffer capacity is 32kb
sourcepub fn no_masking(self) -> Self
pub fn no_masking(self) -> Self
Disable payload masking. By default ws client masks frame payload.
sourcepub fn header<K, V>(self, key: K, value: V) -> Selfwhere
HeaderName: HttpTryFrom<K>,
V: IntoHeaderValue,
pub fn header<K, V>(self, key: K, value: V) -> Selfwhere
HeaderName: HttpTryFrom<K>,
V: IntoHeaderValue,
Set request header
sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set websocket handshake timeout
Handshake timeout is a total time for successful handshake. Default value is 5 seconds.
sourcepub fn connect(&mut self) -> ClientHandshake
pub fn connect(&mut self) -> ClientHandshake
Connect to websocket server and do ws handshake
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !Send for Client
impl !Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more