HTML and CSS Reference
In-Depth Information
Table 3-2. WebSocket Sec- Headers and Their Descriptions (RFC 6455)
Header
Description
Sec-WebSocket-Key
Can only appear once in an HTTP request.
Used in the opening WebSocket handshake from the
client to the server to prevent cross-protocol attacks.
See Sec-WebSocket-Accept.
Sec-WebSocket-Accept
Can only appear once in an HTTP response.
Used in the opening WebSocket handshake from
the server to the client, to confirm that the server
understands the WebSocket protocol.
Sec-WebSocket-Extensions
May appear multiple times in an HTTP request (which is
logically the same as a single Sec-WebSocket-Extensions
header field that contains all values), but can only
appear once in an HTTP response.
Used in the WebSocket opening handshake from the
client to the server, and then from the server to the
client. This header helps the client and server agree on
a set of protocol-level extensions to use for the duration
of the connection.
Sec-WebSocket-Protocol
Used in the opening WebSocket handshake from the
client to the server, then from the server to negotiate a
subprotocol. This header advertises the protocols that
a client-side application can use. The server uses the
same header to select at most one of those protocols.
Sec-Websocket-Version
Used in the opening WebSocket handshake from the
client to the server to indicate version compatibility.
The version for RFC 6455 is always 13. The server
responds with this header if it does not support the
version of the protocol requested by the client. In that
case, the header sent by the server lists
the versions it does support. This only happens if the
client predates RFC 6455.
Message Format
While a WebSocket connection is open, the client and server can send messages to each
other at any time. These messages are represented on the network with a binary syntax
that marks the boundaries between messages and includes concise type information.
More precisely, these binary headers mark the boundaries between something else,
called frames . Frames are partial data that can be combined to form messages. You may
see “frame” and “message” used interchangeably in discussions about WebSocket. These
terms are both used because it is (at least currently) rare to use more than one frame per
 
 
Search WWH ::




Custom Search