Questions tagged [comet]

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:

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:

  1. 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.
  2. 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.

  1. Java: Jetty, Rupy
  2. .NET: WebSync
  3. Python: Twisted
  4. Ruby: Event Machine
  5. JavaScript: Node.js
  6. Scala: Lift
  7. C++: CppCMS

More information

Some good resources for Comet include:

  1. http://ajaxpatterns.org/HTTP_Streaming
  2. http://cometdaily.org/
1111 questions
6
votes
3 answers

Creating 100,000 tcp connections using .NET

I am writing a little Comet server in C#, and to test it I have written a little program that opens a bunch of connections, writes a little text to each of them, and then closes each of them: int basePort = 30000; IPAddress localAddress = new…
Daryl
  • 1,023
  • 1
  • 8
  • 9
6
votes
2 answers

Advantage of COMET over long request polling?

I've been wondering if there is a real advantage to using COMET / push-technologies over the much simpler polling with long requests where the server will wait a certain maximum time for new events to happen before telling the clients that nothing…
fforw
  • 5,391
  • 1
  • 18
  • 17
6
votes
2 answers

How does Google Analytics Real Time work?

I'm wondering how Google Analytics Real Time user interface works, what's the technique ? Do they use long-polling from the client to keep the UI statistics instantly up to date by delivering realtime information from the server to the client? I…
Alexandre
  • 7,004
  • 5
  • 54
  • 72
6
votes
0 answers

Implementing the AsyncContext notifier thread

Here's the scenario: typical web push/comet application where short messages must be pushed at the same time to 3000-4000 connected users; moving from 1 thread/connection model to a new implementation using Servlet 3.0 (AsyncContext) on Tomcat…
felixx
  • 71
  • 3
6
votes
2 answers

my own long polling implementation compared to facebook and gmail

For days I have been experimenting with long polling/comet implementation for my site. I got the basic idea of how it works, this is where i run some tests. On the other hand, I have been observing(firebug) how gmail and facebook implement long…
n3rfd
  • 275
  • 2
  • 11
6
votes
2 answers

PHP Jquery: chat system, what is the Ideal framework for this?

I want to implement a chat system for my site. The functionality will be very similar to facebook chat. The chats will be one to one based. I know how to build the chat system using PHP, MySql and using JQuery. But my concern is that it won’t scale…
LazyDeveloper
  • 111
  • 2
  • 5
6
votes
1 answer

How to use long-polling (preferably without Comet or node.js)?

Suppose I'm synchronizing text on an HTML page, stored in localStorage from computer A to computer B. When the user edits the text on computer A, I send a request to the server, and tell it what text changed. Is there any way that I can get the…
Some Guy
  • 15,854
  • 10
  • 58
  • 67
6
votes
8 answers

GWT / Comet: any experience?

Is there any way to "subscribe" from GWT to JSON objects stream and listen to incoming events on keep-alive connection, without trying to fetch them all at once? I believe that the buzzword-du-jour for this technology is "Comet". Let's assume that…
Alexander Temerev
  • 2,654
  • 3
  • 27
  • 34
6
votes
1 answer

Javascript implementation of WS-I Reliable Secure Profile

I'm using the .NET 4 server side implementation of Reliable Secure Profile for HTTP/S push and want to know if there is a JavaScript client available.
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
6
votes
3 answers

How do modern implementations of Comet/Reverse AJAX work? Any stable C# WCF or ASP.NET implementations?

What is the correct way (or best) way to implement Comet, HTTP Push, or Reverse AJAX? What .NET implementations would you recommend?
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
6
votes
4 answers

PHP + Comet (long-polling) scaling / hosts

I have developped an application using PHP/MySQL which used comet technology, presicely long-polling. The proof of concept works great, but I am expecting traffic to quickly reach thousands of simultanous connections = thousands of open connections…
Chetane
  • 240
  • 1
  • 3
  • 10
6
votes
1 answer

How to do C# Ajax Comet via WebAPI2?

I have a C# ASP.Net (non MVC) project that uses Ajax Comet long-polling. A web page makes a HTTP call to an endpoint handled by a class implementing IHttpAsyncHandler. If there is nothing to report (within n seconds) to the web page, an empty…
Steve Hibbert
  • 2,045
  • 4
  • 30
  • 49
6
votes
1 answer

C# HttpWebResponse Comet problem

I am wondering how I would go about reading a persistent connection with HttpWebRequest and HttpWebResponse. The problem seems to be that the GetResponseStream() function waits for the server connection to be closed before returning. Is there an…
Kosaki
  • 103
  • 1
  • 4
6
votes
3 answers

How can I retrieve updated records in real-time? (push notifications?)

I'm trying to create a ruby on rails ecommerce application, where potential customers will be able to place an order and the store owner will be able to receive the order in real-time. The finalized order will be recorded into the database (at the…
Alex
  • 453
  • 5
  • 14
6
votes
1 answer

Using HTTP long polling when sockets are available (e.g. iPhone, Blackberry)

I'm currently writing a simple cross platform app with Node.js on the server and web/iPhone/Blackberry clients. Bandwidth and latency requirements are similar to something you would see in an IRC "party game" or any chat system. I've developed the…
turtlesoupy
  • 325
  • 4
  • 7