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
50
votes
3 answers

Redis command to get all available channels for pub/sub?

I search through redis command list. I couldn't find the command to get all the available channels in redis pub/sub. In meteor server, the equivalent command is LISTCHANNELS, where it lists all known channels, the number of messages stored on each…
Shuwn Yuan Tee
  • 5,578
  • 6
  • 28
  • 42
43
votes
1 answer

What specific use cases call for BOSH over WebSockets and long-polling?

BOSH is... a transport protocol that emulates the semantics of a long-lived, bidirectional TCP connection between two entities (such as a client and a server) by efficiently using multiple synchronous HTTP request/response pairs without requiring…
a paid nerd
  • 30,702
  • 30
  • 134
  • 179
42
votes
2 answers

How do I use Comet with Spring MVC?

I'd like to add some Comet/server push capabilities to a simple web application. I'm having trouble finding up to date information on how to do this. Can anyone point me to some examples, tutorials, blogs, or anything recent that walks you through…
leedm777
  • 23,444
  • 10
  • 58
  • 87
34
votes
3 answers

Refused to set unsafe header "Origin" when using xmlHttpRequest of Google Chrome

Got this error message: Refused to set unsafe header "Origin" Using this code: function getResponse() { document.getElementById("_receivedMsgLabel").innerHTML += "getResponse() called.
"; if (receiveReq.readyState == 4…
Derrick LAU
  • 441
  • 1
  • 4
  • 5
33
votes
5 answers

How does a WCF server inform a WCF client about changes? (Better solution then simple polling, e.g. Comet or long polling)

see also "WCF push to client through firewall" I need to have a WCF client that connect to a WCF server, then when some of the data changes on the server the clients need to update its display. As there is likely to be a firewall between the…
Ian Ringrose
  • 51,220
  • 55
  • 213
  • 317
33
votes
7 answers

Simple comet example using php and jquery

Can anyone give me a good and simple example of the comet technique using PHP? I just need an example that uses a persistent HTTP connection or something similar. I don't want to use a polling technique, because I have something like that set up…
Ray
33
votes
4 answers

Stop the browser "throbber of doom" while loading comet/server push iframe

When using Comet, or Ajax Long Pull techniques - an iframe is usually used. And while that iframe is waiting for the long connection to close, the browser is spinning its throbber (the progress/loading indicator). Some websites, for example…
Evgeny
  • 6,533
  • 5
  • 58
  • 64
32
votes
6 answers

HTML 5 Websockets will replace Comet?

It looks like Websockets in HTML 5 will become a new standard for server push. Does that mean the server push hack called Comet will be obsolete? Is there a reason why I should learn how to implement comet when Websockets soon (1-2 years) will be…
never_had_a_name
  • 90,630
  • 105
  • 267
  • 383
31
votes
4 answers

Chrome's loading indicator keeps spinning during XMLHttpRequest

I'm writing an AJAX web app that uses Comet/Long Polling to keep the web page up to date, and I noticed in Chrome, it treats the page as if it's always loading (icon for the tab keeps spinning). I thought this was normal for Google Chrome + Ajax…
Martin Konecny
  • 57,827
  • 19
  • 139
  • 159
28
votes
4 answers

Server Scalability - HTML 5 websockets vs Comet

Many Comet implementations like Caplin provide server scalable solutions. Following is one of the statistics from Caplin site: A single instance of Caplin liberator can support up to 100,000 clients each receiving 1 message per second with an…
P.K
  • 18,587
  • 11
  • 45
  • 51
28
votes
3 answers

Need help understanding Comet in Python (with Django)

After spending two entire days on this I'm still finding it impossible to understand all the choices and configurations for Comet in Python. I've read all the answers here as well as every blog post I could find. It feels like I'm about to…
XOR
  • 381
  • 5
  • 4
28
votes
4 answers

How use Django with Tornado web server?

How do I use Django with the Tornado web server?
xRobot
  • 25,579
  • 69
  • 184
  • 304
26
votes
6 answers

Stopping a iframe from loading a page using javascript

Is there a way in javascript of stopping an iframe in the middle of loading a page? The reason I need to do this is I have a background iframe streaming data from a web server (via a Comet style mechanism) and I need to be able to sever the…
Konrad
  • 39,751
  • 32
  • 78
  • 114
25
votes
6 answers

Implement Comet / Server push in Google App Engine in Python

How can I implement Comet / Server push in Google App Engine in Python?
Lev
  • 6,487
  • 6
  • 28
  • 29
24
votes
2 answers

How can I scale socket.io?

Let's say a server gets 10,000 concurrent connections (via socket.io). That's a lot, and if it can't handle any more, I need to spin up another server. How can I sync the two servers together with their socket.io?
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
1
2
3
74 75