Chapter 11: Real Time
THE REAL-TIME WEB is one of those golden eggs of the Internet. Very cool when you come across it, but perhaps quite daunting when it comes to building it. This chapter will show you the choices of technology and how spectacularly simple the client-side code is.
There are two options to add a real-time aspect to your web application: Websockets and Server-Sent Events. WebSockets let you create a connected stream to your server (for server boffins out there: a TCP connection), and allow two-way, real-time communication between the server and the client. The typical hello world app is a chat client, but the possibilities of use are endless. Sockets go a long way toward replacing Comet-based code. Comet uses a variety ...