Which version of websockets protocol draft does google chrome implement

前端 未结 1 1485
太阳男子
太阳男子 2021-02-11 01:20

I am trying to implement a websockets server in java but I am having trouble understanding the version of websocket protocol does google chrome implements. In this blog post the

相关标签:
1条回答
  • 2021-02-11 02:02

    Chrome currently implements draft-hixie-thewebsocketprotocol-76 which is also known as draft-ietf-hybi-thewebsocketprotocol-03. The protocol and specs are now being published by the IETF HyBi working group thus the 03 numbering is actually more correct and the next versions of the spec will continue that numbering (but most people still call it v76).

    The handshake you are getting from Chrome-8.0.552 does match the spec. The differences are because the ordering of the headers can vary and the keys will have different values for every new connection and the host, origin, path, and protocol values depend on how the Javascript invokes the connection and also depend on the URL of the invoking page.

    The response will look something like this (although not exactly because the response is generated based on the client handshake):

    HTTP/1.1 101 WebSocket Protocol Handshake
    Upgrade: WebSocket
    Connection: Upgrade
    Sec-WebSocket-Origin: http://example.com
    Sec-WebSocket-Location: ws://example.com/demo
    Sec-WebSocket-Protocol: sample
    
    8jKS'y:G*Co,Wxa-
    

    I've been following the HyBi working group and there is no estimate for when the protocol will be finalized. However, a new draft (04) has already been published trying to address security concerns of the browser vendors. A (05) version will likely be published in the next few weeks. The browser vendors probably won't implement 04 (because there are still significant areas of low consensus). If most of the browser vendors adopt 05 and there are no additional security concerns I suspect that the final version of the protocol will not change much from there.

    It's important to note however, that the browser API for WebSockets is likely not going to be affected by changes in the protocol.

    0 讨论(0)
提交回复
热议问题