Update: For a more complete and cross-browser/cross-platform solution, I recommend you check out Socket.IO, which I'm actively maintaining.