2.
数据长度在
128-65525
之间时
,
Payload Length
位设为
126
,
后面
额外使用
16bit
表
示长度
(
前面的
126
不再是长度的一部分
)
3.
数据长度在
65526-2^64-1
之间时
,
Payload Length
位设为
127
,
后面
额外使用
64bit
表示长度
(
前面的
127
不再是长度的一部分
)
1.
Fin (bit 0): determines if this is the last frame in the message. This would be
set to 1 on the end of a series of frames, or in a single-frame message, it would
be set to 1 as it is both the first and last frame.
2.
RSV1, RSV2, RSV3 (bits 1-3): these three bits are reserved for websocket
extensions, and should be 0 unless a specific extension requires the use of any
of these bytes.
3.
Opcode (bits 4-7): these four bits deterimine the type of the frame. Control
frames communicate WebSocket state, while non-control frames
communicate data. The various types of codes include:
1.
x0: continuation frame; this frame contains data that should be appended to
the previous frame
2.
x1: text frame; this frame (and any following) contains text
3.
x2: binary frame; this frame (and any following) contains binary data
4.
x3 - x7: non-control reserved frames; these are reserved for possible
websocket extensions
5.
x8: close frame; this frame should end the connection
6.
x9: ping frame
7.
xA: pong frame
8.
xB - xF: control reserved frames