python websocket server_用Python实现一个简单的WebSocket服务器

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值