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
5 answers

Pushing messages to clients from a server-side application?

I have a javascript-based client that is currently polling a .NET web service for new content. While polling works...I'm not happy with this approach because I'm using system resources and creating overhead when there aren't any changes to receive.…
Achilles
  • 11,165
  • 9
  • 62
  • 113
6
votes
1 answer

Design pattern to integrate Rails with a Comet server

I have a Ruby on Rails (2.3.5) application and an APE (Ajax Push Engine) server. When records are created within the Rails application, i need to push the new record out on applicable channels to the APE server. Records can be created in the rails…
empire29
  • 3,729
  • 6
  • 45
  • 71
6
votes
3 answers

How should I implement reverse AJAX in a Django application?

How should I implement reverse AJAX when building a chat application in Django? I've looked at Django-Orbited, and from my understanding, this puts a comet server in front of the HTTP server. This seems fine if I'm just running the Django…
Carson Myers
  • 37,678
  • 39
  • 126
  • 176
6
votes
2 answers

Comet (long polling) and XmlHttpRequest status

I'm playing around a little bit with raw XmlHttpRequestObjects + Comet Long Polling. (Usually, I'd let GWT or another framework handle of this for me, but I want to learn more about it.) I wrote the following code: function longPoll() { var xhr =…
Chris Lercher
  • 37,264
  • 20
  • 99
  • 131
6
votes
4 answers

comet HTTP patterns in Java

I'm writing/porting a C++ HTTP event server to Java. I'm wondering what are the best paradigms for implementing comet with Jetty, Tomcat, any other server, or natively. Threaded Continuations NIO Servlet 3.0 Scalability is an absolute must as I'm…
David Titarenco
  • 32,662
  • 13
  • 66
  • 111
6
votes
3 answers

Implement a Comet server in C#

I would like to know whether there is a way to write a comet server in C#. i have a C# code that generates data periodically, and I want to push these data to a java app. So would like to convert my C# code to a comet server. Also would like to…
sura
  • 1,471
  • 4
  • 17
  • 25
6
votes
2 answers

Can XMPP be used like Comet's http long wait?

Can XMPP be applied in a similar way to the reverse Ajax pattern? Can it be used to implement http long wait like Comet? Is there an example of using such a technique with XMPP?
cometta
  • 35,071
  • 77
  • 215
  • 324
6
votes
3 answers

PHP chat active users

I have added a chat capability to a site using jquery and PHP and it seems to generally work well, but I am worried about scalability. I wonder if anyone has some advice. The key area for me I think is efficiently managing awareness of who is…
Tony Jackson
  • 135
  • 1
  • 1
  • 6
6
votes
1 answer

Timeout behavior of different browsers?

I am writing an on line chat room based on AJAX/COMET. My design is: Request ----------------- wait -------------------------> send dump data ----------------- wait -------------------------> send dump data ----------------- wait…
Fang-Pen Lin
  • 13,420
  • 15
  • 66
  • 96
6
votes
1 answer

Implementing COMET clientside

I have read up about what COMET streaming is, and all the various hacks required to get it working across the major browsers. The problems encountered seem to be two fold: 1. Server being able to support many persistent connections 2. Implementing…
jeffreyveon
  • 13,400
  • 18
  • 79
  • 129
5
votes
1 answer

Using atmosphere for GWT Comet

I was looking for a simple framework for implementing Comet for my GWT application. I looked on gwt-rocket which seems to be non active, then on gwt-comet which is not active, then on atmosphere-gwt-comet which was moved into the atmosphere project,…
Ben Bracha
  • 1,377
  • 2
  • 15
  • 28
5
votes
3 answers

How to make a HTTP connection using C?

How do I make an HTTP connection using C? Any references or sample code out there? Further, how do I implement opening a Comet connection from client written in C? (Any additional info about opening an HTTPS connection would also be appreciated.)…
ikevin8me
  • 4,253
  • 5
  • 44
  • 84
5
votes
5 answers

PHP infinitive loop or jQuery setInterval?

Js: