A little more than a month ago, Ian Hickson released draft 76 of the WebSocket protocol, which was unusually incompatible with previous drafts. Headers in the client upgrade request grew a Sec-Websocket prefix, and there is now an interesting challenge-response computation that needs to be performed on the headers and body. Caveat Emptor to those who implement draft specifications, I guess!
Thus far, Chrome seems to be the major test browser for WebSockets (though Safari implements them as well), and they switched over to draft 76 a few weeks ago. So the Chrome betas speak draft 75, and the nightlies speak 76.
Fortunately, it’s possible to write WebSocket servers that interoperate seamlessly with both versions, by detecting those new Sec-Websocket headers and doing the appropriate handshake for the appropriate version. Andrew Godwin implemented this logic for Eventlet’s websocket module, so you can use it to serve sockets to any browser that’s out there today. Find it in the development branch, which you can install by running easy_install eventlet==dev.
We’ll be keeping a weather eye on the spec as it proceeds.

Posted by Ben on June 15, 2010 at 5:58 am
Hey Ryan,
This is great! Saves some work for me :-)
One request though: As I and probably a lot of other people will be using websockets in a web framework of some description, do you mind if I have a tinker with this and make it standalone outside of the WebSocketWSGI class?
What did you think of this code I showed you a couple of weeks ago as an API?
http://github.com/boothead/rpz.websocket/blob/master/rpz/websocket/handshake.py
Cheers,
Ben
Posted by Ryan Williams on August 5, 2010 at 7:00 am
Ben, I apologize for my late reply. There is something seriously wrong with WordPress’s email notifications (or I am super-dumb). >:(
I absolutely support refactoring this code outside of the class. I kinda started to do that myself but didn’t finish. The handshake code you have there looks supa-clean.