Websocket Draft 76

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.

About these ads

5 responses to this post.

  1. 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

  2. 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.

  3. I was wondering if you ever considered changing the layout of your blog?
    Its very well written; I love what youve got to
    say. But maybe you could a little more in the way of content so people could
    connect with it better. Youve got an awful lot of text for only having 1 or 2 images.
    Maybe you could space it out better?

  4. There is definately a lot to find out about this subject.
    I like all of the points you’ve made.

  5. Excellent post. I was checking continuously
    this blog and I am impressed! Extremely helpful info
    specially the last part :) I care for such info much.
    I was looking for this certain info for a long time.
    Thank you and best of luck.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.