Pergunta

I came across this code change in Chromium. It says Chromium now supports both handshake versions, which the code seems to confirm. I mean the second version at Wikipedia (draft-ietf-hybi-thewebsocketprotocol-06).

However, when I connect to my server, the only thing I obtain is the old version, i.e. including these headers:

Sec-WebSocket-Key1: 4 @1  46546xW%0l 1 5
Sec-WebSocket-Key2: 12998 5 Y3 1  .P00

but not the new version which would be a request containing:

Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==

What am I missing here? I downloaded the latest nightly build and it has been included more than two weeks ago, so that cannot be the cause I guess.

How can I make a WebSocket send the new handshake version?

Foi útil?

Solução

The code link you posted is for the server-side of the handshake (there is a few places this will likely be used in Chrome such as remote debugging and as a proxy for extensions).

If you really want use the new HyBi-07 protocol version you can try using this branch of web-socket-js that I made. Once Chrome switch to the new protocol, web-socket-js will switch by default also. In order to make web-socket-js work in a browser that already has WebSockets support you will need make some minor tweaks to it to use a different object name instead of WebSocket.

I expect Chrome/WebKit will add the new protocol before long. Note that the API changes to add binary support have only recent been decided so Chrome the new protocol may be added before the API fully supports the new functionality enabled by the protocol.

Outras dicas

The only browser I know of that implements the 07 protocol is this build of FF4:

http://www.ducksong.com/misc/websockets-builds/ws-07/

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top