gimite / web-socket-js

HTML5 Web Socket implementation powered by Flash
BSD 3-Clause "New" or "Revised" License
2.73k stars 489 forks source link

New Web Sockets protocol revision 76 #14

Closed lisitsky closed 14 years ago

lisitsky commented 14 years ago

Hi. Thank you for the excellent program. Some days ago new protocol revision was accepted - http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76 Changes are very big. Mainly they are security related. Now servers and clients made on different revisons (75 or earlier and 76) can't work with each other. New versions of WebKit, Safari and Chrome use new version: http://blog.chromium.org/2010/06/websocket-protocol-updated.html

Could you implement new revision? Thank you!

scottwhite commented 14 years ago

I forked and made an "implementation" not saying it's awesome, but it works. I notice this when I got a nightly of webkit and it stopped working. http://github.com/scottwhite/em-websocket Should probably do a pull request :)

lisitsky commented 14 years ago

Thank you.

gimite commented 14 years ago

scottwhite, looks like your fork is for em-websocket, not for web-soccket-js. Do you also have patch for web-socket-js?

I'm planning to implement new protocol in web-socket-js soon, but patch is welcome if someone has already implemented it.

scottwhite commented 14 years ago

No, I thought the only change was for the initial hand shaking which seemed to only effect native implementations (since flash uses it's own hand shake).

gimite commented 14 years ago

web-socket-js also uses the same handshake, implemented here: http://github.com/gimite/web-socket-js/blob/master/flash-src/WebSocket.as#L131 so I also need to change that.

gimite commented 14 years ago

Implemented new protocol with: http://github.com/gimite/web-socket-js/commit/71517cfd10079464966df848cfeaad2de26e05c8

lisitsky commented 14 years ago

Thank youu!

petrblaho commented 14 years ago

Hi, I have found problem with Chrome - it uses new handshaking protocol version 76 from version 6.0.414 - but Google ships version 5.0.375 to casual users - which uses version 75. So this code

if (window.WebSocket) return;
will return and browser will use its own WebSocket with old handshaking protocol and connection will fail at server side. Is it possible to detect version of handshaking protocol used by WebSocket implementation in browser and override browser's WebSocket with flash?

lisitsky commented 14 years ago

Hello!

I think it's better to use dual-version server now, while both versions are popular. In this case we are ready to work with all clients, and their upgrade will be transparent for us. As example of this server I can recommend misultin. I asked it's author Roberto to add support for rev 76, and he made support for both revisions simultaneously.