Chapter 8. Scaling with Comet
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. ...
Get Even Faster Web Sites now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.