Comet is a generic term used to describe technology used to "push" data from a web server to connected web clients. In contrast to a "typical" web connection, in which the client must request data before the server can respond with that data, with Comet implementations, data can be pushed from the server without the client requesting said data. Comet can be implemented in a variety of ways: long-polling, callback-polling, forever-frame, etc.
Comet is a generic term used to describe technology used to "push" data from a web server to connected web clients. In contrast to a "typical" web connection, in which the client must request data before the server can respond with that data, with Comet implementations, data can be pushed from the server without the client requesting said data.
Comet can be implemented in a variety of ways:
- long-polling,
- callback-poll,
- forever-frame or
- using html5 technologies like server-sent events and websocket.
Each has a variety of pros and cons, such as compatibility, cross-domain capabilities, and feature support (such as detecting disconnections, etc.).
Each Comet server is typically comprised of two major components:
- The server component. This component is responsible for handling the connections to the clients, and where much development effort is spent; small optimizations in this code make huge changes overall (for example, if one client stores 1 KB additional data, and you have 30,000 clients connected, that is an extra 30 MB of data that the server needs to store and track.
- The client component. This component is responsible for receiving data from the server component. The most common client is written in JavaScript, for use with a web browser, but clients can often be written in other languages as well, to facilitate integration with thick client applications. For example, Jetty has a client written in Java, and WebSync has clients written for Silverlight and standard .NET.
Common Language Implementations
There are a large amount of frameworks that could power a Comet based application. Most of these are standalone servers, with the exception of WebSync which runs on top of IIS.
- Java: Jetty, Rupy
- .NET: WebSync
- Python: Twisted
- Ruby: Event Machine
- JavaScript: Node.js
- Scala: Lift
- C++: CppCMS
More information
Some good resources for Comet include: