I’m excited that the WebSocket protocol is picking up so much steam — it’s a great abstraction for real-time web programming, and I can’t wait to see it in every browser. That will unfortunately take longer than we would like, but in the meantime we have various flash implementations of the protocol. Besides Google Chrome and Safari 5, today there are no stand-alone, proxy-aware WebSocket clients. Additionally, WebSocket is only truly a proxy-tunneling protocol when used in encrypted mode. For these reasons, I’ve authored the Comet Session Protocol, a current-day architectural drop in for WebSocket.
Quick Bullet points about CSP
- Provides a bi-direcitonal, client <–> server stream
- Well specified
- Works in all browsers without plugins
- Traverses all intermediaries for http and https (proxies, firewalls, anti-virus, etc.)
- Architectural WebSocket drop-in for older browsers
With the Twisted/python CSP implementation you would take the exact same steps, except at run time you would alternatively (or additionally) call something like:
and like that your TCP-based protocol implementation is now exposed to the web. CSP is not meant to replace either TCP or WebSocket, but to co-exist with both. You might have one server that listens for all three protocols if you were targeting desktop/mobile, Chrome/Safari, and Internet Explorer.
The specification is still relatively young, but implementations of CSP have been in production for almost a year now. The best client implementation at this time is js.io; multiple server implementations exist, including csp_eventlet, csp (twisted), and js.io (runs on top of node.js).