There's a book coming soon that covers this topic...
Professional XMPP with JavaScript and jQuery
alt text http://ecx.images-amazon.com/images/I/51B7VAHw8OL._SL500_AA240_.jpg
But I'm assuming you don't want to wait for the book. So watch the Jack Moffitt's presentation from JSConf. I watched it this morning. (Jack Moffitt is the author of the book linked to above.)
The library involved (JavaScript and C implementations) is Strophe.
This is a very fruitful area of exploration, but very raw. We'll see more soon. WebSockets come with HTML5, is that right?