pub fn encode(frame: &Frame) -> Result<Vec<u8>, CodecError>Expand description
Encodes a Frame into the WebSocket wire byte slice.
If frame.masking_key is set, the payload is XOR-masked during
encoding (Spec §5.3).
§Errors
CodecError::ControlFrameTooLongif a control frame has a payload > 125 bytes (Spec §5.5).CodecError::FragmentedControlFrameif a control frame has FIN=0 (Spec §5.5).