pub struct CompressedProtocol { /* private fields */ }Expand description
WebSocket protocol handler with permessage-deflate compression (RFC 7692)
Implementations§
Source§impl CompressedProtocol
impl CompressedProtocol
Sourcepub fn server(
max_frame_size: usize,
max_message_size: usize,
config: DeflateConfig,
) -> Self
pub fn server( max_frame_size: usize, max_message_size: usize, config: DeflateConfig, ) -> Self
Create a new compressed protocol handler for server role
Sourcepub fn client(
max_frame_size: usize,
max_message_size: usize,
config: DeflateConfig,
) -> Self
pub fn client( max_frame_size: usize, max_message_size: usize, config: DeflateConfig, ) -> Self
Create a new compressed protocol handler for client role
Sourcepub fn is_closing(&self) -> bool
pub fn is_closing(&self) -> bool
Check if we’re in the closing handshake
Sourcepub fn process(&mut self, buf: &mut BytesMut) -> Result<Vec<Message>>
pub fn process(&mut self, buf: &mut BytesMut) -> Result<Vec<Message>>
Process incoming data and return complete messages
Sourcepub fn process_into(
&mut self,
buf: &mut BytesMut,
messages: &mut Vec<Message>,
) -> Result<()>
pub fn process_into( &mut self, buf: &mut BytesMut, messages: &mut Vec<Message>, ) -> Result<()>
Process incoming data into a reusable message buffer
Sourcepub fn encode_message(
&mut self,
msg: &Message,
buf: &mut BytesMut,
) -> Result<()>
pub fn encode_message( &mut self, msg: &Message, buf: &mut BytesMut, ) -> Result<()>
Encode a message for sending with compression
Sourcepub fn encode_pong(&mut self, ping_data: &[u8], buf: &mut BytesMut)
pub fn encode_pong(&mut self, ping_data: &[u8], buf: &mut BytesMut)
Encode a pong response for a ping
Sourcepub fn encode_close_response(&mut self, buf: &mut BytesMut)
pub fn encode_close_response(&mut self, buf: &mut BytesMut)
Encode a close response
Sourcepub fn split(
self,
max_frame_size: usize,
max_message_size: usize,
) -> (CompressedReaderProtocol, CompressedWriterProtocol)
pub fn split( self, max_frame_size: usize, max_message_size: usize, ) -> (CompressedReaderProtocol, CompressedWriterProtocol)
Split the compressed protocol into separate reader and writer halves
This allows the encoder and decoder to be used independently for concurrent read/write operations.
Auto Trait Implementations§
impl Freeze for CompressedProtocol
impl RefUnwindSafe for CompressedProtocol
impl Send for CompressedProtocol
impl Sync for CompressedProtocol
impl Unpin for CompressedProtocol
impl UnwindSafe for CompressedProtocol
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