A little-known web tech for real time chat and video chat - WebRTC - is actually pretty powerful and under appreciated.
WebRTC is many things - but think of it as allowing peer to peer video chats (and of course things less cooler than that but just as important: such as voice, text, file transfer) from *browser to browser* (peer to peer - remember that?).
How it works:
WebRTC works by using STUN/ICE protocols/techniques to discover the effective public IPs and then allow inbound packets of data, even if a browser is behind a NAT firewall (not that different to what things like Skype do).
A picture helps explain:
Bob and Alice want to video chat - they use the a central Websocket based application to co-ordinate their chat - then when the video chat starts - data flows directly from Bob to Alice and the reverse - but how? NATs and Firewalls only allow outbound data, normally right? Part of the STUN/ICE technique is to use an intermediary service to find the IP that Bob and Alice's traffic comes from - this is their "effective IP" - which can be used to talk directly between them:
Think of it like this: Alice starts talking to Bob's effective public IP. This normally wouldn't work, but in the meantime, Bob has started talking to Alice's effective IP - this means that Bob is *expecting* data to come from Alice (and as far as firewalls/nats are concerned - it is all outbound connections and request/response) - and Alice is expecting data to come from Bob (in response to her outbound connection). Google Hangouts also use this, in theory, this gives you the lowest latency point to point - and you can experience this for yourself.
The other key part of this is that there is a broker service in the middle to co-ordinate the sessions and broker connection - this is what WebRTC is about - along with a nice simple JS/HTML5 api - and this requires both Websocket and the "latest" browsers (Firefox and Chrome, at the time of writing).
Thanks to the excellent work done with Nginx websocket support, CloudBees has been able to run Websockets - you can try it out yourself:
Our partners Telestax have WebRTC support, and have built it into a ClickStack for Cloudbees. You can read more about this here: http://www.telestax.com/webrtc_cloudbees/ ;
Here I am chatting to a friend who was in San Francisco at the time, which is the other side of the pacific ocean from me. This chat was fast and felt very real time with no real noticeable round the world lag - which is common when there are too many intermediate servers.
WebRTC enabled a lot more - some people have done file transfer browser to browser - and it looks like it could be a nice addition to many web apps that involve people talking to other people!