pub struct Client<'a, T> { /* private fields */ }
Expand description
Websocket client handshake.
Implementations
sourceimpl<'a, T: AsyncRead + AsyncWrite + Unpin> Client<'a, T>
impl<'a, T: AsyncRead + AsyncWrite + Unpin> Client<'a, T>
sourcepub fn new(socket: T, host: &'a str, resource: &'a str) -> Self
pub fn new(socket: T, host: &'a str, resource: &'a str) -> Self
Create a new client handshake for some host and resource.
sourcepub fn set_buffer(&mut self, b: BytesMut) -> &mut Self
pub fn set_buffer(&mut self, b: BytesMut) -> &mut Self
Override the buffer to use for request/response handling.
sourcepub fn take_buffer(&mut self) -> BytesMut
pub fn take_buffer(&mut self) -> BytesMut
Extract the buffer.
sourcepub fn set_origin(&mut self, o: &'a str) -> &mut Self
pub fn set_origin(&mut self, o: &'a str) -> &mut Self
Set the handshake origin header.
sourcepub fn add_protocol(&mut self, p: &'a str) -> &mut Self
pub fn add_protocol(&mut self, p: &'a str) -> &mut Self
Add a protocol to be included in the handshake.
sourcepub fn add_extension(&mut self, e: Box<dyn Extension + Send>) -> &mut Self
pub fn add_extension(&mut self, e: Box<dyn Extension + Send>) -> &mut Self
Add an extension to be included in the handshake.
sourcepub fn drain_extensions(
&mut self
) -> impl Iterator<Item = Box<dyn Extension + Send>> + '_
pub fn drain_extensions(
&mut self
) -> impl Iterator<Item = Box<dyn Extension + Send>> + '_
Get back all extensions.
sourcepub async fn handshake(&mut self) -> Result<ServerResponse, Error>
pub async fn handshake(&mut self) -> Result<ServerResponse, Error>
Initiate client handshake request to server and get back the response.
sourcepub fn into_builder(self) -> Builder<T>
pub fn into_builder(self) -> Builder<T>
Turn this handshake into a connection::Builder
.
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Get out the inner socket of the client.
Trait Implementations
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for Client<'a, T>
impl<'a, T> Send for Client<'a, T> where
T: Send,
impl<'a, T> !Sync for Client<'a, T>
impl<'a, T> Unpin for Client<'a, T> where
T: Unpin,
impl<'a, T> !UnwindSafe for Client<'a, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more