The Web is increasingly happening in realtime. With websites such as Facebook and Twitter leading the way, users are coming to expect that all sites should serve content as it occurs -- on smartphones as well as computers. This book shows you how to build realtime user experiences by adding chat, streaming content, and including more features on your site one piece at a time, without making big changes to the existing infrastructure. You'll also learn how to serve realtime content beyond the browser.
Throughout the book are many practical JavaScript and Python examples that you can use on your site now. And in the final chapter, you'll build a location-aware game that combines all of the technologies discussed.
Use the latest realtime syndication technology, including PubSubHubbub
Build dynamic widgets on your homepage to show realtime updates from several sources
Learn how to use long polling to "push" content from your server to browsers
Create an application using the Tornado web server that makes sense of massive amounts of streaming content
Understand the unique requirements for setting up a basic chat service
Use IM and SMS to enable users to interact with your site outside of a web browser
Implement custom analytics to measure engagement in realtime
Chapter 1 Introduction
What Is Realtime?
Push Versus Pull
Prerequisites
The Rest
Chapter 2 Realtime Syndication
Simple Update Protocol (SUP)
PubSubHubbub
Chapter 3 The Dynamic Homepage (Widgets in Pseudorealtime)
The Basic Widgets
FriendFeed in Realtime
Live Images
It Was All a Setup!
Chapter 4 River of Content
A Crash Course in Server Push
Setting Up Your Cometd Environment
A Realtime Live Blog
Server-Side Filters (with Java)
Integrating Cometd into Your Infrastructure
Chapter 5 Taming the Firehose with Tornado
Tornado
Twitter’s Realtime Streaming APIs
From the Firehose to the Web Browser
Chapter 6 Chat
Setting Up the Basic Code
Logging In
Basic Chatting
Acting Natural
Chapter 7 Instant Messaging
Getting Started with Google App Engine
Receiving Instant Messages
Sending Instant Messages
Responding Intelligently
Setting Up an API
Chapter 8 SMS
The SMS Landscape
Building the Basic Application
Sending and Receiving the Messages
Chapter 9 Measuring User Engagement: Analytics on the Realtime Web
Ted Roden was the first full-time developer hired on at Vimeo.com, and currently works in the Research and Development group at The New York Times. His work researching and prototyping topics closely related to the content of this book has been profiled by Harvard University's Nieman Journalism Lab (http://bit.ly/f7rdJhttp://bit.ly/YzELI). At the Times, he has also worked on bringing election night coverage, maps, and updates to the mobile website, as well as March Madness fantasy brackets. He is also the creator of a popular social bookmarking site: enjoysthin.gs.
The animal on the cover of Building the Realtime User Experience is a common hill myna (Gracula religiosa). Myna birds (sometimes spelled mynah) are not a biological group: instead, humans applied the term to species of the starling family that are native to India and surrounding areas. These are very social animals, and are typically found in forested areas in groups of around six individuals. Mynas are omnivorous, with a diet of insects, nectar, and fruit.
Common hill mynas have glossy black plumage with white patches on their wings. Their bill is colored orange fading into yellow (rather like a piece of candy corn), and their legs are yellow. They have distinctive yellow wattles beneath their eyes and on the back of their neck. The position and shape of these wattles are the easiest way to distinguish between the various hill mynas of the Gracula genus. Rather than walking with the jaunty gait common to other starlings, hill mynas hop from branch to branch in the treetops.
Myna birds are famous for their talking ability, and the common hill myna in particular is renowned for mimicry. In the wild, this species has a large repertoire of calls shared by neighboring groups—local dialects that change completely between different areas. In captivity, if training begins at a young age, these mynas are able to imitate a wide range of phrases and sounds with uncanny accuracy and pitch. Myna owners should remember that these birds are intelligent, will only learn phrases that appeal to them (an enthusiastic tone of voice usually catches their attention), and are always listening to conversation around them. Check out Johnny Carson’s interview session with a myna bird at http://bit.ly/bWJFYu.