O'Reilly logo

Introducing HTML5, Second Edition by Remy Sharp, Bruce Lawson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11: Real Time

Remy Sharp

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required