pub struct WebSocketReader { /* private fields */ }Expand description
Runner thread for a websockets connection
Implementations§
Source§impl WebSocketReader
impl WebSocketReader
Sourcepub fn new_unchecked(read_stream: OwnedReadHalf) -> WebSocketReader
pub fn new_unchecked(read_stream: OwnedReadHalf) -> WebSocketReader
Generates a new instance of the websocket reader, assuming the handshake has already been performed
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 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 spawn<H: WebSocketThread + 'static>(
self,
wst: H,
) -> JoinHandle<<H as WebSocketThread>::Output>
pub fn spawn<H: WebSocketThread + 'static>( self, wst: H, ) -> JoinHandle<<H as WebSocketThread>::Output>
Spawns a tokio thread that dispatches the message to the proved handler
Trait Implementations§
Source§impl AsRef<TcpStream> for WebSocketReader
impl AsRef<TcpStream> for WebSocketReader
Source§impl From<WebSocketReader> for OwnedReadHalf
impl From<WebSocketReader> for OwnedReadHalf
Source§fn from(source: WebSocketReader) -> OwnedReadHalf
fn from(source: WebSocketReader) -> OwnedReadHalf
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for WebSocketReader
impl !RefUnwindSafe for WebSocketReader
impl Send for WebSocketReader
impl Sync for WebSocketReader
impl Unpin for WebSocketReader
impl !UnwindSafe for WebSocketReader
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