pub struct WebSocket { /* private fields */ }Expand description
a WebSocket client that never blocks (see the top of this file); dropping it closes it
Implementations§
Source§impl WebSocket
impl WebSocket
Sourcepub fn connect_with(url: &str, o: WsOptions) -> Result<WebSocket, Error>
pub fn connect_with(url: &str, o: WsOptions) -> Result<WebSocket, Error>
connect with these limits: Connecting at once, Open once the upgrade is done
Sourcepub fn send_text(&self, s: &str) -> Result<(), Error>
pub fn send_text(&self, s: &str) -> Result<(), Error>
send a text message (Open only; desktop: queued, Backlog beyond max_unsent)
Sourcepub fn close(&self, code: u16, reason: &str)
pub fn close(&self, code: u16, reason: &str)
close with code (1000, 3000-4999) and a reason (at most 123 bytes)
Sourcepub fn close_info(&self) -> Option<(u16, String)>
pub fn close_info(&self) -> Option<(u16, String)>
how it ended (code and reason; 1006: without a close frame or never connected); None while it is not Closed
Auto Trait Implementations§
impl !RefUnwindSafe for WebSocket
impl !UnwindSafe for WebSocket
impl Forget for WebSocket
impl Freeze for WebSocket
impl Move for WebSocket
impl Send for WebSocket
impl Sync for WebSocket
impl Unpin for WebSocket
impl UnsafeUnpin for WebSocket
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