Socket Proliferation
July 5th, 2008 by Michael CarterSince discussing browser sockets, I’ve been doing some research on other implementations. For some time now, David Davis has had a browser socket with his Sprocket.Socket implementation.
I must give David credit for being so forward thinking, being the first to release a browser socket. With the Orbited project, we had to undergo a lengthy process to arrive at the same conclusion he had already found. We realized that we wanted reliable delivery with message ordering guarantees, so we created a protocol that we called Comet Session Protocol (CSP). Next, we started working on an API for CSP, and decided that we might as well use HTML5’s then-named TCPConnection API. We worked with that for a while, and then realized that we weren’t actually honoring the API because we didn’t implement the server-side protocol (TCPConnection then, like WebSocket now, had an extra handshake for security, and framing.) So we went and implemented that, only to realize that we didn’t really need the TCPConnection security provided by the handshake — Orbited could provide it instead via access control! So we created a TCPSocket API which simulates a raw socket in the browser.
I must say — I am extremely impressed with David’s clear understanding of the problem domain. It took the entire Orbited core developer team a few months to follow this line of reasoning and end up where we are now.
Also of note, JP Calderone put together an alternative implementaiton using Twisted Athena, and I imagine more will soon follow. This is great news. Having multiple browser socket implementations is exactly what we need. This way, users can experiment with the various servers and choose whichever works best for them. It leaves us free to move up the stack — That is, we can begin implementing protocols on top of our basic API. We should make sure to all choose the same basic API so that any protocol implementation can actually be used with any server.
For now, the Orbited project will continue protocol work with the TCPSocket interface. I think its important to keep as close to the WebSocket API as possible. Of course, I’m open to discussion from anyone interested in joining forces or providing some advice.

July 6th, 2008 at 11:55 pm
Thanks for your kind words. I’d be happy to help and share some code.
Also, have you looked at BOSH? (also called HTTP bind)