HTTP module

ws

[WebSocket]({#ref classicy_1_1http_1_1ws_1_1WebSocket #}) framing, handshakes, and connection helpers.

ws

WebSocket framing, handshakes, and connection helpers.

Classes

NameDescription
ConnectionAdapterWebSocket class which belongs to an HTTP connection.
WebSocketStandalone WebSocket class.
WebSocketAdapterWebSocket protocol adapter for both client and server endpoints.
WebSocketException
WebSocketFramerWebSocket frame encoder/decoder and handshake validator for RFC 6455.

Enumerations

NameDescription
ModeWebSocket endpoint mode.
FrameFlagsFrame header flags.
OpcodeFrame header opcodes.
SendFlagsCombined header flags and opcodes for identifying the payload type of sent frames.
CloseStatusCodeStatusCodes for CLOSE frames sent with shutdown().
ErrorCodeThese error codes can be obtained from WebSocket exceptions to determine the exact cause of the error.
CloseState

Mode

enum Mode

WebSocket endpoint mode.

ValueDescription
ServerSideServer-side WebSocket.
ClientSideClient-side WebSocket.

FrameFlags

enum FrameFlags

Frame header flags.

ValueDescription
FinFIN bit: final fragment of a multi-fragment message.
Rsv1Reserved for future use. Must be zero.
Rsv2Reserved for future use. Must be zero.
Rsv3Reserved for future use. Must be zero.

Opcode

enum Opcode

Frame header opcodes.

ValueDescription
ContinuationContinuation frame.
TextText frame.
BinaryBinary frame.
CloseClose connection.
PingPing frame.
PongPong frame.
BitmaskBit mask for opcodes.

SendFlags

enum SendFlags

Combined header flags and opcodes for identifying the payload type of sent frames.

ValueDescription
Text
Binary

CloseStatusCode

enum CloseStatusCode

StatusCodes for CLOSE frames sent with shutdown().

ValueDescription
NormalClose
EndpointGoingAway
ProtocolError
PayloadNotAcceptable
Reserved
ReservedNoStatusCode
ReservedAbnormalClose
MalformedPayload
PolicyViolation
PayloadTooBig
ExtensionRequired
UnexpectedCondition
ReservedTLSFailure

ErrorCode

enum ErrorCode

These error codes can be obtained from WebSocket exceptions to determine the exact cause of the error.

ValueDescription
NoHandshakeNo Connection: Upgrade or Upgrade: websocket header in handshake request.
HandshakeNoVersionNo Sec-WebSocket-Version header in handshake request.
HandshakeUnsupportedVersionUnsupported WebSocket version requested by client.
HandshakeNoKeyNo Sec-WebSocket-Key header in handshake request.
HandshakeAcceptNo Sec-WebSocket-Accept header or wrong value.
UnauthorizedThe server rejected the username or password for authentication.
PayloadTooBigPayload too big for supplied buffer.
IncompleteFrameIncomplete frame received.
InvalidRsvBitsRSV bits set without extension negotiation.
InvalidOpcodeUnknown or reserved opcode received.
UnmaskedClientFrameClient-to-server frame not masked (RFC 6455 violation).
ProtocolViolationGeneral RFC 6455 protocol violation.

CloseState

enum CloseState
ValueDescription
Open
CloseSent
CloseReceived
Closed

Variables

ReturnNameDescription
constexpr autoServerSide static
constexpr autoClientSide static
constexpr charProtocolGuid
constexpr charProtocolVersionThe WebSocket protocol version supported (13).

ServerSide

static

constexpr auto ServerSide = Mode::ServerSide

ClientSide

static

constexpr auto ClientSide = Mode::ClientSide

ProtocolGuid

constexpr char ProtocolGuid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"

ProtocolVersion

constexpr char ProtocolVersion = "13"

The WebSocket protocol version supported (13).