Struct tungstenite::protocol::frame::FrameSocket
source · pub struct FrameSocket<Stream> { /* private fields */ }
Expand description
A reader and writer for WebSocket frames.
Implementations§
source§impl<Stream> FrameSocket<Stream>
impl<Stream> FrameSocket<Stream>
sourcepub fn from_partially_read(stream: Stream, part: Vec<u8>) -> Self
pub fn from_partially_read(stream: Stream, part: Vec<u8>) -> Self
Create a new frame socket from partially read data.
sourcepub fn into_inner(self) -> (Stream, Vec<u8>)
pub fn into_inner(self) -> (Stream, Vec<u8>)
Extract a stream from the socket.
sourcepub fn get_mut(&mut self) -> &mut Stream
pub fn get_mut(&mut self) -> &mut Stream
Returns a mutable reference to the inner stream.
source§impl<Stream> FrameSocket<Stream>where
Stream: Read,
impl<Stream> FrameSocket<Stream>where Stream: Read,
source§impl<Stream> FrameSocket<Stream>where
Stream: Write,
impl<Stream> FrameSocket<Stream>where Stream: Write,
sourcepub fn write_frame(&mut self, frame: Frame) -> Result<()>
pub fn write_frame(&mut self, frame: Frame) -> Result<()>
Write a frame to stream.
This function guarantees that the frame is queued regardless of any errors. There is no need to resend the frame. In order to handle WouldBlock or Incomplete, call write_pending() afterwards.
sourcepub fn write_pending(&mut self) -> Result<()>
pub fn write_pending(&mut self) -> Result<()>
Complete pending write, if any.