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(stream: TcpStream) -> WebSocketStream
pub fn from_tcp_stream_unchecked(stream: TcpStream) -> WebSocketStream
Wraps a tcp stream withot checking the handshake or anything
Sourcepub fn set_permit(&mut self, permit: OwnedSemaphorePermit)
pub fn set_permit(&mut self, permit: OwnedSemaphorePermit)
Auxiliar function that cataclysm uses to keep track of connections
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 !Freeze for WebSocketStream
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