pub enum ProtocolError {
Show 14 variants
InvalidOpcode(u8),
ReservedBitsSet {
bits: u8,
},
MaskedFrameFromServer,
UnmaskedFrameFromClient,
PayloadTooLarge {
size: u64,
max: u64,
},
ControlFrameTooLarge {
size: u64,
},
FragmentedControlFrame,
InvalidCloseCode(u16),
InvalidUtf8InCloseReason,
CloseFrameTooShort,
ContinuationWithoutStart,
NewMessageDuringAssembly,
InvalidUtf8,
MessageTooLarge {
accumulated: usize,
max: usize,
},
}Expand description
Protocol error from WebSocket frame decoding.
Each variant is a specific RFC 6455 violation. No catch-all.
Variants§
InvalidOpcode(u8)
Frame header contains an unrecognized opcode.
ReservedBitsSet
Reserved bits (RSV1-3) are set without a negotiated extension.
MaskedFrameFromServer
Server sent a masked frame (RFC 6455 §5.1: server MUST NOT mask).
UnmaskedFrameFromClient
Client sent an unmasked frame (RFC 6455 §5.1: client MUST mask).
PayloadTooLarge
Frame payload exceeds the configured maximum frame size.
ControlFrameTooLarge
Control frame payload exceeds 125 bytes (RFC 6455 §5.5).
FragmentedControlFrame
Control frame is fragmented (RFC 6455 §5.5: MUST NOT be fragmented).
InvalidCloseCode(u16)
Close frame has invalid status code.
InvalidUtf8InCloseReason
Close frame reason is not valid UTF-8.
CloseFrameTooShort
Close frame payload is 1 byte (must be 0 or >= 2).
ContinuationWithoutStart
Received a continuation frame with no preceding start frame.
NewMessageDuringAssembly
Received a new data frame (Text/Binary) while assembling fragments.
InvalidUtf8
Text message payload is not valid UTF-8.
MessageTooLarge
Assembled message exceeds the configured maximum message size.
Trait Implementations§
Source§impl Clone for ProtocolError
impl Clone for ProtocolError
Source§fn clone(&self) -> ProtocolError
fn clone(&self) -> ProtocolError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtocolError
impl Debug for ProtocolError
Source§impl Display for ProtocolError
impl Display for ProtocolError
Source§impl Error for ProtocolError
impl Error for ProtocolError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ProtocolError> for Error
impl From<ProtocolError> for Error
Source§fn from(e: ProtocolError) -> Self
fn from(e: ProtocolError) -> Self
Source§impl PartialEq for ProtocolError
impl PartialEq for ProtocolError
Source§fn eq(&self, other: &ProtocolError) -> bool
fn eq(&self, other: &ProtocolError) -> bool
self and other values to be equal, and is used by ==.