Struct cataclysm_ws::WebSocketStream
source · pub struct WebSocketStream { /* private fields */ }Expand description
Wrapper structure of a tcp stream with some websockets utilities
Implementations§
source§impl WebSocketStream
impl WebSocketStream
sourcepub fn from_tcp_stream_unchecked(tcp_stream: TcpStream) -> WebSocketStream
pub fn from_tcp_stream_unchecked(tcp_stream: TcpStream) -> WebSocketStream
Wraps a tcp stream withot checking the handshake or anything
sourcepub async fn send_message(&self, message: Message) -> Result<(), Error>
pub async fn send_message(&self, message: Message) -> Result<(), Error>
Sends a message through the websockets connection
sourcepub async fn try_read_frame(&self) -> Result<Frame, Error>
pub async fn try_read_frame(&self) -> Result<Frame, Error>
Blocks until a message is received
sourcepub fn split(self) -> (WebSocketWriter, WebSocketReader)
pub fn split(self) -> (WebSocketWriter, WebSocketReader)
Splits the stream into the reading and writting part
Trait Implementations§
source§impl AsMut<TcpStream> for WebSocketStream
impl AsMut<TcpStream> for WebSocketStream
source§impl AsRef<TcpStream> for WebSocketStream
impl AsRef<TcpStream> for WebSocketStream
Auto Trait Implementations§
impl RefUnwindSafe for WebSocketStream
impl Send for WebSocketStream
impl Sync for WebSocketStream
impl Unpin for WebSocketStream
impl UnwindSafe for WebSocketStream
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