pub struct WebSocketClient { /* private fields */ }Expand description
WebSocket client for connecting to WebSocket servers.
Implementations§
Source§impl WebSocketClient
impl WebSocketClient
Sourcepub fn builder() -> WebSocketClientBuilder
pub fn builder() -> WebSocketClientBuilder
Create a new client builder.
Sourcepub async fn connect(url: &str) -> WebSocketResult<Self>
pub async fn connect(url: &str) -> WebSocketResult<Self>
Connect to a WebSocket server.
Sourcepub async fn connect_with_timeout(
url: &str,
timeout: Duration,
) -> WebSocketResult<Self>
pub async fn connect_with_timeout( url: &str, timeout: Duration, ) -> WebSocketResult<Self>
Connect to a WebSocket server with a timeout.
Sourcepub fn send(&self, message: Message) -> WebSocketResult<()>
pub fn send(&self, message: Message) -> WebSocketResult<()>
Send a message to the server.
Sourcepub fn send_binary<B: Into<Bytes>>(&self, data: B) -> WebSocketResult<()>
pub fn send_binary<B: Into<Bytes>>(&self, data: B) -> WebSocketResult<()>
Send a binary message.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WebSocketClient
impl RefUnwindSafe for WebSocketClient
impl Send for WebSocketClient
impl Sync for WebSocketClient
impl Unpin for WebSocketClient
impl UnwindSafe for WebSocketClient
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