Struct websocket::dataframe::DataFrame
[−]
[src]
pub struct DataFrame { pub finished: bool, pub reserved: [bool; 3], pub opcode: Opcode, pub data: Vec<u8>, }
Represents a WebSocket data frame.
The data held in a DataFrame is never masked. Masking/unmasking is done when sending and receiving the data frame,
This DataFrame, unlike the standard Message implementation (which also
implements the DataFrame trait), owns its entire payload. This means that calls to payload
don't allocate extra memory (again unlike the default Message implementation).
Fields
finished | Whether or no this constitutes the end of a message |
reserved | The reserved portion of the data frame (RFC6455 5.2) |
opcode | The opcode associated with this data frame |
data | The payload associated with this data frame |
Methods
impl DataFrame
fn new(finished: bool, opcode: Opcode, data: Vec<u8>) -> DataFrame
Creates a new DataFrame.
fn read_dataframe<R>(reader: &mut R, should_be_masked: bool) -> WebSocketResult<Self> where R: Read
Reads a DataFrame from a Reader.