I would suggest anyone implementing this take a look at faye-websocket. It was recently extracted from a production-quality project named Faye, which uses a pub-sub broadcast model based on bayeux. The websocket implementation has numerous fallbacks, and is well-tested. I'm using it in production currently.
https://github.com/faye/faye-websocket-ruby