HTML 5 中的握手
Websockets 是 HTML 5 的一个令人兴奋的新概念,其中有一个特定的功能 - WebSockets 服务器和客户端之间的握手。谁能解释一下这个是做什么用的??
谢谢你!!
In Websockets, which is an exciting new concept of HTML 5, there is a specific feature - Handshaking between the WebSockets server and Client. Can anyone explain what this is used for??
Thank You!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
找到参考:http://en.wikipedia.org/wiki/Web_Sockets#Server_Implementations
Found a reference: http://en.wikipedia.org/wiki/Web_Sockets#Server_Implementations
您可以在此处阅读有关 websockets 协议(包括握手)的更多信息: https ://datatracker.ietf.org/doc/html/draft-ietf-hybi-thewebsocketprotocol-06
you can read more about the websockets protocol including the handshake here: https://datatracker.ietf.org/doc/html/draft-ietf-hybi-thewebsocketprotocol-06
握手过程用于建立和验证连接。握手的目的是证明服务器已经读取了客户端的握手。这是通过使用 2 个字段来完成的:Sec-WebSocket-Key1 和 Sec-WebSocket-Key2。 Sec-WebSocket-Key1 和 Sec-WebSocket-Key2 字段是 8 字节随机令牌,服务器(然后)使用它们在握手结束时构造 16 字节令牌...然后用于证明服务器已读取客户的握手信息。
The handshake process is used in establishing and validating a connection. The purpose of the handshake is to prove the server has read the client's handshake. This is accomplished through the use of 2 fields: Sec-WebSocket-Key1 and Sec-WebSocket-Key2. The Sec-WebSocket-Key1 and Sec-WebSocket-Key2 fields are 8-byte random tokens which the server (then) uses to construct a 16-byte token at the end of its handshake...this then is used to prove the server has read the client's handshake.