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

Indicate to an ajax process that the delayed job has completed

I have a Rails 3 app that uses delayed_job to fetch some data (with a class method) when the user hits the page. How can I indicate to the ajax process that the class method has run (so that I can stop polling)? EDIT: To clarify, I want to know when…
lightyrs
  • 2,809
  • 2
  • 29
  • 32
8
votes
2 answers

Polling, Comet, WebSockets, etc

I'm needing to build in some pretty agressive "auto refresh" capabilities into a web application. It's kind of a photo gallery and the images are stored on AmazonS3 but the data about the images are stored in our own database. I've played around…
Gregg
  • 34,973
  • 19
  • 109
  • 214
8
votes
5 answers

Creating a real-time chat with php and javascript

My goal is to create a real-time chat similar to the Facebook chat, from scratch. I want to store all the messages on a database table (MySQL) and every time a new message is sent by a user, if the receiver is connected then a request will be sent…
Thanasis1101
  • 1,614
  • 4
  • 17
  • 28
8
votes
3 answers

Comet VS Ajax polling

I need to create a chat like facebook chat. With Comet I need more memory to keep the connection. With Ajax polling there is a latency problem if I send request every 3-4 seconds. So... If the latency ( 3-4 seconds ) doesn't matter, Is Ajax Polling…
xRobot
  • 25,579
  • 69
  • 184
  • 304
8
votes
4 answers

Finishing a HttpServletResponse but continue processing

I have a situation that seems to fit the Async Servlet 3.0 / Comet situation but all I need to do is return a 200 response code (or other) after accepting the incoming parameters. Is there a way for a HttpServlet to complete the http…
Stevko
  • 4,345
  • 6
  • 39
  • 66
8
votes
8 answers

Server push: comet vs ape?

I've read a little about comet and also APE. Which one is better? I want the users to see other users updated content. Like Google Wave. And in comet, there are 2 versions: iframe vs traditional ajax. what is the difference and which is better. I…
ajsie
  • 77,632
  • 106
  • 276
  • 381
8
votes
1 answer

How does xsockets.net (.NET WebSocket Server) run on Windows 2008?

I am comparing WebSocket servers xsockets.net SuperWebSocket Fleck SignalR SignalR is only available on Server 2012, but my servers are running Windows 2008. SuperWebSocket & Fleck, they only support flash-proxy fallback. xsockets.net, this one…
Mr.Wang from Next Door
  • 13,670
  • 12
  • 64
  • 97
8
votes
2 answers

Efficient reloading data / pushing data from server to client

I'm looking for the 'way to go' (i.e. the most efficient, most used, general accepted way) when it comes to the reloading of data from a web server to a front end. In the end application, I will have several output fields where data has to be…
user1544337
8
votes
1 answer

Difference between async servlet long poll and bayeux protocol (Comet)

What is the difference between a simple Async servlet and the Comet / Bayeux protocol? I am trying to implement a "Server Push" (or "Reverse Ajax") kind of webpage that will receive updates from the server as and when events occur on the server. So…
Basanth Roy
  • 6,272
  • 5
  • 25
  • 25
8
votes
3 answers

Issues with long polling XMLHttpRequests and intermittent network connections

I've implemented a long polling connection to allow me to do server-side push (comet) using a Tomcat web server and standard javascript on the frontend. To keep the connection going, I have a simple keep-alive loop that initiates a new request as…
dallas
  • 83
  • 1
  • 3
8
votes
2 answers

comet vs pubsub..?

may i know what is the different between these 2 approach ? can explain in lay man terms?
cometta
  • 35,071
  • 77
  • 215
  • 324
7
votes
4 answers

Reverse Ajax without Comet?

Is it possible to let the web server send a message to the web browser without Comet? Every major web company like Facebook and Google uses Comet for this purpose and it just seems like an ugly hack waiting to disappear if tcp connections were…
Unknown
  • 45,913
  • 27
  • 138
  • 182
7
votes
1 answer

XMPP BOSH vs COMET

I want to write a real-time chat application and in need to decide which technologies to use. What are the differences between these technologies and which do you prefer and why? WebSockets in not an option, since its not ready to fight in…
Ahmet Recep Navruz
  • 713
  • 11
  • 14
7
votes
4 answers

Play framework longpolling in online game

I'm working on a browser game with the play framework, and I definitely need longpolling, but I don't quite understand how to use it. WebSockets would be perfect for this, but it's not supported by that many browsers yet. Here's what I want to do:…
user393964
7
votes
3 answers

NodeJS + socket.io: simple Client/Server example not working

I’m using NodeJS v0.4.8 and the latest Version of socket.io from npm install socket.io on Ubuntu: Linux mars 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux The following code unfortunately doesn't produce…
helix
  • 196
  • 1
  • 2
  • 10