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

The latest recommendation for Comet in Python?

I'm going to be implementing Comet in Python (even though I hear good things about erlycomet I'm not thrilled about supporting an Erlang-based web server in addition to everything else in our back end). I've found several…
John R
  • 231
  • 1
  • 2
  • 4
22
votes
1 answer

Can flask framework send real-time data from server to client browser?

I was wondering how (if at all) flask performs long polling, so the server can send data over a connection to the client. For example if the server receives a twitter feed via the streaming api how will that be passed to the client browser? I gather…
user94628
  • 3,641
  • 17
  • 51
  • 88
20
votes
2 answers

Long Polling/HTTP Streaming General Questions

I'm trying to make a theoretical web chat application with php and jquery, I've read about long polling and http streaming, and I managed to apply most principles introduced in the articles. However, there are 2 main things I still can't get my head…
Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
20
votes
9 answers

COMET (server push to client) on iPhone

I'm looking to establish some kind of socket/COMET type functionality from my server(s) to my iPhone application. Essentially, anytime a user manages to set an arbitrary object 'dirty' on the server, by say, updating their Address.. the feedback…
Coocoo4Cocoa
  • 48,756
  • 50
  • 150
  • 175
20
votes
4 answers

Is Comet obsolete now with Server-Sent Events and WebSocket?

or do Server-Sent Events and WebSocket replace Comet techniques?
orad
  • 15,272
  • 23
  • 77
  • 113
19
votes
2 answers

How websockets can be faster than a simple HTTP request?

You still need to send requests from your computer to the website's server and back and forth. How can websockets make it so much faster?
good_evening
  • 21,085
  • 65
  • 193
  • 298
19
votes
1 answer

how to combine django plus gevent the basics?

After much searching and googling I am coming back to the well. I have Django 1.4 and am looking for a decent working example to figure out getting Django to work with gevent. I like the Django framwork but I need it to handle long polling. I…
Tereus Scott
  • 674
  • 1
  • 6
  • 11
18
votes
4 answers

COMET javascript library

I am looking for a simple and reliable Comet javascript library. I want to keep a persistent streaming of data from my server (via PHP script) to the client side. I tried building my own using the iframe technique, but there are lots of issues with…
philly77
  • 519
  • 3
  • 8
  • 14
18
votes
4 answers

Is there a difference between long-polling and using Comet

I am implementing a system where I need real-time updates. I have been looking at certain scenarios and among all was Comet. Implementing this I do not see any way this is different from traditional long-polling. In both cases you have to send a…
Saif Bechan
  • 16,551
  • 23
  • 83
  • 125
17
votes
1 answer

Architecture Implementation and Design for a Notification System using socket.io node.js and incoming messages

Disclaimers I have not worked with node.js before I have not used socket.io before I'm looking at implementing a Google Plus, Facebook, StackOverflow style notification system. I'm not an inexperienced developer, and eventually I will figure this…
Layke
  • 51,422
  • 11
  • 85
  • 111
17
votes
2 answers

Django and Long Polling

I need to implement long polling in my application to retrieve the events. But I have no idea how to do it. I know the concept of long polling, i.e to leave the connection open, until an event occurs. But how do I do implement this in my project. If…
Robin
  • 5,366
  • 17
  • 57
  • 87
17
votes
2 answers

Websocket complications

This is complicated, and not necessarily one question. I'd appreciate any possible help. I've read that is is possible to have websockets without server access, but I cannot seem to find any examples that show how it is. I've come to that conclusion…
Witold Kowelski
  • 924
  • 2
  • 12
  • 27
17
votes
5 answers

Best solution for Java HTTP push (messaging)

We want to push data from a server to clients but can only use HTTP (port 80). What is the best solution for messaging? One idea is Comet. Are there other ideas or frameworks which offer lets say JMS over HTTP. (Yes, ActiveMQ supports it too, but…
crusam
  • 6,140
  • 6
  • 40
  • 68
15
votes
7 answers

nginx proxy to comet

I need some help from some linux gurus. I am working on a webapp that includes a comet server. The comet server runs on localhost:8080 and exposes the url localhost:8080/long_polling for clients to connect to. My webapp runs on localhost:80. I've…
Chris
  • 283
  • 1
  • 2
  • 7
14
votes
2 answers

How to implement redis's pubsub timeout feature?

I want to use Redis's pubsub feature to implement comet, but pubsub doesn't have timeout, so if I use ps.listen(), it will block, even if client closes browser. Greenlet has a timeout feature when spawn process, but I don't know how to combine…
limboy
  • 3,879
  • 7
  • 37
  • 53
1 2
3
74 75