Struct actix_http::ws::Parser
source · pub struct Parser;Expand description
A struct representing a WebSocket frame.
Implementations§
source§impl Parser
impl Parser
sourcepub fn parse(
src: &mut BytesMut,
server: bool,
max_size: usize
) -> Result<Option<(bool, OpCode, Option<BytesMut>)>, ProtocolError>
pub fn parse( src: &mut BytesMut, server: bool, max_size: usize ) -> Result<Option<(bool, OpCode, Option<BytesMut>)>, ProtocolError>
Parse the input stream into a frame.
sourcepub fn parse_close_payload(payload: &[u8]) -> Option<CloseReason>
pub fn parse_close_payload(payload: &[u8]) -> Option<CloseReason>
Parse the payload of a close frame.
sourcepub fn write_message<B: AsRef<[u8]>>(
dst: &mut BytesMut,
pl: B,
op: OpCode,
fin: bool,
mask: bool
)
pub fn write_message<B: AsRef<[u8]>>( dst: &mut BytesMut, pl: B, op: OpCode, fin: bool, mask: bool )
Generate binary representation
sourcepub fn write_close(dst: &mut BytesMut, reason: Option<CloseReason>, mask: bool)
pub fn write_close(dst: &mut BytesMut, reason: Option<CloseReason>, mask: bool)
Create a new Close control frame.