O'Reilly logo

Even Faster Web Sites by Steve Souders

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 8. Scaling with Comet

Dylan Schiemann

Sometimes Ajax just isn’t fast enough.

When data needs to be asynchronously sent from the server to the client, Ajax alone is often inadequate. Comet is a catchall term describing the collection of techniques, protocols, and implementations that address making low-latency data transit to the browser both viable and scalable. Comet is not an acronym, but a humorous play on the term Ajax coined by Alex Russell.[23]

Goals of Comet include delivering data from the server to the client at any time, improving speed and scalability over traditional Ajax, and developing event-driven web applications.

Ajax and the introduction of background HTTP requests are clearly the defining technology that enables the performance possible in today’s web applications. However, browsers and the traditional request/response pattern used in HTTP are ill-equipped to scale to the needs of more demanding real-time applications such as chat, financial information, and document collaboration. All of these applications require low-latency data transit to deliver on user experience expectations.

In this chapter, I’ll briefly cover how Comet works, and I’ll discuss the techniques that are common today and the performance pros and cons of each. I’ll conclude with solutions to cross-domain Comet and to other web application implementation issues when using Comet techniques.

How Comet Works

Comet works by taking advantage of less commonly used features of the HTTP specification. ...

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