Struct tungstenite::protocol::frame::Frame [−][src]
pub struct Frame { /* fields omitted */ }
A struct representing a WebSocket frame.
Implementations
impl Frame
[src]
impl Frame
[src]pub fn len(&self) -> usize
[src]
Get the length of the frame. This is the length of the header + the length of the payload.
pub fn is_empty(&self) -> bool
[src]
Check if the frame is empty.
pub fn header(&self) -> &FrameHeader
[src]
Get a reference to the frame’s header.
pub fn header_mut(&mut self) -> &mut FrameHeader
[src]
Get a mutable reference to the frame’s header.
pub fn payload(&self) -> &Vec<u8>
[src]
Get a reference to the frame’s payload.
pub fn payload_mut(&mut self) -> &mut Vec<u8>
[src]
Get a mutable reference to the frame’s payload.
pub fn into_data(self) -> Vec<u8>
[src]
Consume the frame into its payload as binary.
pub fn into_string(self) -> StdResult<String, FromUtf8Error>
[src]
Consume the frame into its payload as string.
pub fn message(data: Vec<u8>, opcode: OpCode, is_final: bool) -> Frame
[src]
Create a new data frame.
pub fn pong(data: Vec<u8>) -> Frame
[src]
Create a new Pong control frame.
pub fn ping(data: Vec<u8>) -> Frame
[src]
Create a new Ping control frame.
pub fn close(msg: Option<CloseFrame<'_>>) -> Frame
[src]
Create a new Close control frame.
pub fn from_payload(header: FrameHeader, payload: Vec<u8>) -> Self
[src]
Create a frame from given header and data.
pub fn format(self, output: &mut impl Write) -> Result<()>
[src]
Write a frame out to a buffer