Struct awc::ws::WebsocketsRequest
source · pub struct WebsocketsRequest { /* private fields */ }
Expand description
WebSocket connection.
Implementations§
source§impl WebsocketsRequest
impl WebsocketsRequest
sourcepub fn address(self, addr: SocketAddr) -> Self
pub fn address(self, addr: SocketAddr) -> Self
Set socket address of the server.
This address is used for connection. If address is not provided url’s host name get resolved.
Available on crate feature cookies
only.
cookies
only.Set a cookie
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 server_mode(self) -> Self
pub fn server_mode(self) -> Self
Disable payload masking. By default ws client masks frame payload.
sourcepub fn header<K, V>(self, key: K, value: V) -> Selfwhere
HeaderName: TryFrom<K>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
V: TryIntoHeaderValue,
pub fn header<K, V>(self, key: K, value: V) -> Selfwhere
HeaderName: TryFrom<K>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
V: TryIntoHeaderValue,
Append a header.
Header gets appended to existing header.
To override header use set_header()
method.
sourcepub fn set_header<K, V>(self, key: K, value: V) -> Selfwhere
HeaderName: TryFrom<K>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
V: TryIntoHeaderValue,
pub fn set_header<K, V>(self, key: K, value: V) -> Selfwhere
HeaderName: TryFrom<K>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
V: TryIntoHeaderValue,
Insert a header, replaces existing header.
sourcepub fn set_header_if_none<K, V>(self, key: K, value: V) -> Selfwhere
HeaderName: TryFrom<K>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
V: TryIntoHeaderValue,
pub fn set_header_if_none<K, V>(self, key: K, value: V) -> Selfwhere
HeaderName: TryFrom<K>,
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
V: TryIntoHeaderValue,
Insert a header only if it is not yet set.
sourcepub fn basic_auth<U>(self, username: U, password: Option<&str>) -> Selfwhere
U: Display,
pub fn basic_auth<U>(self, username: U, password: Option<&str>) -> Selfwhere
U: Display,
Set HTTP basic authorization header
sourcepub fn bearer_auth<T>(self, token: T) -> Selfwhere
T: Display,
pub fn bearer_auth<T>(self, token: T) -> Selfwhere
T: Display,
Set HTTP bearer authentication header
sourcepub async fn connect(
self
) -> Result<(ClientResponse, Framed<BoxedSocket, Codec>), WsClientError>
pub async fn connect( self ) -> Result<(ClientResponse, Framed<BoxedSocket, Codec>), WsClientError>
Complete request construction and connect to a WebSocket server.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WebsocketsRequest
impl !RefUnwindSafe for WebsocketsRequest
impl !Send for WebsocketsRequest
impl !Sync for WebsocketsRequest
impl Unpin for WebsocketsRequest
impl !UnwindSafe for WebsocketsRequest
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