• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

什么是ebSocket协议?

基于HTTP的协议;

连接的发起者仍然是客户端;

连接建立后,无论服务器还是客户端,任何一方都可以直接向对方发送消息。

主要特点

推送功能:服务器可以直接发送数据,不需要等待客户端的请求。

减少流量:只要建立了WebSocket连接,就希望一直保持连接状态;且报头信息量小;

握手:为了实现WebSocket通信,HTTP连接建立后,需要握手;

与HTTP的主要差别

Keep-alive是HTTP协议级别的长连接,不能主动推送消息,主要用于连接复用。

Websocket是websocket协议的长连接。只要保持开放,连接就一直在,服务器可以主动推送消息。

握手-请求

使用HTTP的Upgrade报头字段通知服务器通信协议已经更改。

Sec-WebSocket-Key字段记录了握手过程中的关键值。

Sec-WebSocket-Protocol字段记录了使用的子协议。

握手-响应

对于前一个请求,返回状态代码为101交换协议的响应。

Sec-WebSocket-Accept的字段值由握手请求中Sec-WebSocket-Key的字段值生成。

握手成功建立WebSocket连接后,通信中不再使用HTTP数据帧,而是使用WebSocket独立数据帧。

iosyp5g05dm4306.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now