HTML and CSS Reference
In the last decade, the web has moved from communication based on uploading static con-
tent, similar to the traditional print publishing model, to a real-time communication system
where tweets and friendings are instantly announced to hundreds of followers. We've all
become so used to dynamically updating web pages that we don't realize most of this is
built as a series of hacks on top of HTML4 and HTTP 1.0/1.1. HTML5 cleans up these
hacks by providing well-defined APIs for messaging—between the browser and web serv-
ers and between different iframes or other objects loaded in the browser.
Because messaging is a complex subject, this will be a complex chapter. You're going to
do a lot and learn a lot. Specifically, you're going to
• Learn how to use server-sent events (SSE). This new client-server API allows
communication from the server without a specific client request.
• Learn how to use WebSockets.
• Dabble in one of the new event-driven, server-side technologies: Node.js.
• Learn about cross-document messaging, an API for communication between pages
and scripts already loaded in the browser.
Why build this chapter's chat and planning board applications?
• You'll build a chat application based on a traditional LAMP/WIMP (Linux,
Apache, MySQL, PHP/Windows, IIS, MySQL, PHP) server stack to learn about
• You'll build a collaborative agile planning board with WebSockets and Node.js.
After you build those two applications, we'll show you how to integrate them on the client
using cross-document messaging.
If you need background on the principles of computer networking, take a side trip through
client-server APIs, as well as define terms like protocol , network stack , latency , through-
put , polling , and event-driven . The appendix will also give you the background to under-
stand why and when to use the new approaches we introduce in this chapter, such as server-
sent events, which we cover in the next section.