ajsie
ajsie

Reputation: 79666

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 dont quite understand it.

Thanks.

Upvotes: 8

Views: 8505

Answers (8)

Alex Yaroshevich
Alex Yaroshevich

Reputation: 740

Comet is a technology, APE is one of a lot implementations. What about iframe vs traditional ajax? Use HTML5 WebSockets anywhere you can use it.

At now all modern browsers use XMLHttpRequest for ajax requests (client-to-server, something back and end). But sometimes JS-applications sending files via iframes and its ok. Not all implementations of XMLHttpRequests supports multipart-data transport (Chrome and modern FF afaik). WebSockets was created especially for Comet-like technologies (when client opening only one connection and web-server pushes some data to client via opened stream or WebSocket) so use it if you can.

BTW I'll recommend you to use independent web-server for your Comet-streams (or channels).

P.S. I like APE.

Upvotes: 3

HackaZach
HackaZach

Reputation: 409

APE is an implementation of Comet. It provides a non-blocking IO server and JS client libraries to implement a publish/subscribe messaging system.

The APE server itself can be programmed using server-side javascript. Server side code such as PHP/Ruby/whatever may broadcast data through APE by issuing 'commands' to the APE server.

Connected clients receive this data by listening for 'Raws' ; which are events and data sent from the APE server to the client.

Upvotes: 1

Tahir Akhtar
Tahir Akhtar

Reputation: 11625

I think you want to compare IFrame based techniques with Ajax (XMLHttp) based techniques.

I think the major difference is that you cannot read the response content of an AJAX request until the whole response is received by the browser. Which means, in order to simulate streaming, you will have to do something like this:

  1. Make a request to the server
  2. On getting a response read the response and make another request

The server can hold on the request if there isn't anything to return yet.

IFrame based solution on the other hand can return multiple script tags in response to a single request. There is no need to send another request until there is a (browser or server) request timeout.

Upvotes: 1

scc
scc

Reputation: 10696

Comet is a set of techniques useful for developing realtime applications. You have two main implementations: streaming and long polling.

In regular http requests the user sends the request to the server, receives the data (html, scrips, etc) and closes the connection - end of story. In streaming the connection is never closed by the client or the server, there's a single connection shared by both parties.

In long polling, you have a recurring connection that waits for a response. Basically, the browser sends a request to the server and sits there waiting until the server responds (the server only responds when he has new data for the client), then the connection is closed and it's up to the browser to reopen a connection, and the cycle repeats :) Of the two, this is the most used.

Comet in the browser typically requires a web server optimized for large numbers of long-lived HTTP connections, and a JavaScript client to communicate with the Comet server. So Ape is an installable server and Comet is the paradigm on which it is based. Here you have a list of comet implementations: http://cometdaily.com/maturity.html

Upvotes: 16

Christopher Tarquini
Christopher Tarquini

Reputation: 11332

Comet = Umbrella term for the technology also known as "reverse ajax" or "long polling"

APE = An implementation of Comet technology.

You can think of Comet being a certain make of car while APE is the model.

See also:

http://en.wikipedia.org/wiki/Comet_%28programming%29

http://www.ape-project.org/ajax-push.html

Upvotes: 7

Priit
Priit

Reputation: 5248

Have a look at WebSockets. Chrome and newer Firefoxes already support it. You can fall back to comet when you really need it on other browsers.

Upvotes: 2

spender
spender

Reputation: 120380

Isn't APE just an implementation of Comet? That's what is says on the product page.

Upvotes: 1

Stewart Robinson
Stewart Robinson

Reputation: 3539

Etherpad.com, the super fast real time document sharing tool used comet to provide near real time screen updates of collaborations from other editors. The company that makes etherpad (AppJet) just got purchased by Google to work on Google Wave

Check out http://etherpad.com/ep/about/faq

and http://code.google.com/p/etherpad/ (open source etherpad) to see their implementation.

I vote for comet because of the commercial success of etherpad and the google wave implementation using comet.

Upvotes: 2

Related Questions