What is Comet (Ajax Push)?
Responsive, low-latency interaction for the web
• A programming technique that enables web
servers to send data to the client without having
any need for the client to request for it
• Allows creation of highly responsive, eventdriven
----> Keep clients up-to-date with data arriving or changing
on the server, without frequent polling
----> Lower latency, not dependent on polling frequency
Server and network do not have to deal with frequent
polling requests to check for updates
Ajax Polling Vs Ajax pushing
Ajax Poll vs Ajax Push
Bending the rules of HTTP.
> Send a request to the server every X seconds
> The response is “empty” if there is no update
• Long Poll: (most popular, demo use)
> Send a request to the server, wait for an event to
happen, then send the response
> The response is never empty
> HTTP specification satisfied: indistinguishable from
• Http Streaming:
> Send a request, wait for events, stream multipart/
chunked response, and then wait for the events
> The response is continually appended to
• GMail and GTalk
(using GlassFish project's Comet)
• Many more …
Comet is a generic term describing various approaches to send data asynchronously from a Web server to a client without the need for the client to explicitly request the data. It is an essential technique for any real-time event-driven web applications, where the majority of events occur on the server and data must be "pushed" frequently to the client.
Financial trading applications are a good example of this; pricing updates occur frequently and must be relayed to the client at a high rate, whereas user generated events such as buying and selling happen less often. Comet is also known as server push, HTTP push, or HTTP streaming.