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
7
votes
2 answers

loading indicator on safari on iphone in long polling

I'm trying to do a long polling using XMLHttpRequest. it works fine on all supporting browsers, but for some reason on safari on iPhone i get the loading indicator for every ajax call, and for long polling thats a bit annoying. I read that you need…
Amir
  • 1,219
  • 3
  • 17
  • 31
7
votes
3 answers

Which one is the best COMET server?

I'm looking for a COMET server, i want to push messages from the server specifically to some users with some id's, i'm using php and i'm looking for a good and easy COMET server. Could you tell me which one is the best?
gustavomanolo
  • 787
  • 1
  • 9
  • 18
7
votes
2 answers

Consuming Google Channel API in C#

The official documentation doesn't mention the support, but I'm wondering if it is possible to hook up a client program instead of javascript to use the Channel API. I'm currently using the basic polling technique from a windows app, having the…
savagepanda
  • 857
  • 12
  • 25
7
votes
3 answers

MySQL trigger + notify a long-polling Apache/PHP connection

I know there are Comet server technologies that do this but I want to write something simple and home-grown. When a record is inserted into a MySQL table, I want it to somehow communicate this data to a series of long-polled Apache connections…
Eric
  • 71
  • 1
  • 2
7
votes
1 answer

Scala Comet and Mobile Applications

I'm exploring using Scala with its Comet facilities for my next project and was curious if anyone had experience using Comet (not necessarily Scala) with: WebOS Android iOS All these phones are WebKit, which should mean that my Chrome tests would…
Stefan Mai
  • 23,367
  • 6
  • 55
  • 61
7
votes
3 answers

Comet, Ajax Push, Reverse Ajax

Someone have any sample of Comet app .net? I need one sample how to persist connection of client in server?
Diego Dias
  • 904
  • 3
  • 15
  • 23
7
votes
2 answers

How Would I Build A NodeJS Websocket Server Without A Library

I've recently built a small JSON webservice in NodeJS, and am interested in extending it to accept requests via WebSockets. Most of the WebSocket tutorials I have found so far are based on 3rd party modules like SocketIO. What does it take to write…
Charlie
  • 4,197
  • 5
  • 42
  • 59
7
votes
5 answers

Are there any open source C#-based non-blocking, event-based web server like Tornado?

I want to build a comet-based application and would like it to be able to sustain up to 1000 concurrent connections. As I understand, Tornado has the advantage of not spawning one thread per request thus allowing it to handle thousands of long poll…
David H
  • 2,901
  • 1
  • 26
  • 21
7
votes
7 answers

Easiest way to make comet chat

I need to make tet-a-tet comet chat with many channels using PHP as a backend and JQuery as a frontend. I need something like event-driven server to do this... But didnt find any simple and appplicable to my task. Please, tell me the best solution…
hexxy
  • 71
  • 1
  • 2
7
votes
4 answers

Can JavaScript detect when the user stops loading the document?

I'm implementing Comet using the script tag long polling technique, based on this page. One issue (that I don't think there's a solution for) is the "throbber of doom" - the browser continues to show the document as "loading" forever and leaves the…
EMP
  • 59,148
  • 53
  • 164
  • 220
7
votes
4 answers

Stop the browser “throbber of doom” while loading comet/server push XMLHttpRequest

(This question is similar to this one, but it's for using XMLHttpRequest instead of an iframe for Comet.) I'm starting an async long poll like this: var xhr = new XMLHttpRequest(); xhr.open('POST', url); xhr.send(); If I do this inside…
Jaka Jančar
  • 11,386
  • 9
  • 53
  • 74
7
votes
1 answer

Node.js and Comet

Basically, I am trying to set up a basic comet server and client using node.js from scratch. A tried to Google things about the process it should work and as I am testing it seems to work fine. However one question is still in my head. First I would…
stomseven
  • 157
  • 1
  • 2
  • 8
7
votes
1 answer

AJAX/Reverse AJAX: Polling or Push?

Been studying a ton on AJAX because I'm making a real-time application out of Javascript and PHP. It needs to be able to update without refreshing the page and in real-time. I tried polling the server with setInterval() but for it to be quick I had…
Tyler Hughes
  • 582
  • 1
  • 9
  • 19
7
votes
6 answers

long polling vs streaming for about 1 update/second

is streaming a viable option? will there be a performance difference on the server end depending on which i choose? is one better than the other for this case? I am working on a GWT application with Tomcat running on the server end. To understand my…
jcee14
  • 908
  • 3
  • 15
  • 28
7
votes
4 answers

What is the magic behind Lightstreamer?

I'm gonna develop a framework for comet programming, and I can't use Web Sockets, or Server-Sent Events (because browser support really sucks). So, I need to keep the HTTP connection alive, and send chunked data back to the client. However, problems…
Saeed Neamati
  • 35,341
  • 41
  • 136
  • 188