Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

ajax - How to implement Comet ?

I have been developing web applications for some time but have very recently been introduced with the Comet server side push technology and my understanding of this technology is very immature. While the link http://www.zeitoun.net/articles/comet_and_php/start provides two simplistic example implementations using an infinite loop in PHP, I would like to know more on the repurcussions of the above methods and if it is suitable for production. What advantages do dedicated comet servers like Meteor(http://meteorserver.org/) , streamhub (http://www.stream-hub.com/), freeliberator (http://www.freeliberator.com/index.php) ?

Also how different is Comet server side push from HTML5 web socket facility ?

My principle objective is to build a variant of collaborative real time document editing facility.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

While the link http://www.zeitoun.net/articles/comet_and_php/start provides two simplistic example implementations using an infinite loop in PHP, I would like to know more on the repurcussions of the above methods and if it is suitable for production.

This solution is one of the factors that has resulted in the concencus that PHP and Comet/WebSockets don't scale. See:

What advantages do dedicated comet servers like Meteor(http://meteorserver.org/) , streamhub (http://www.stream-hub.com/), freeliberator (http://www.freeliberator.com/index.php) ?

The advantages are that these solution were built with the idea of handling multiple concurrent connections in mind. They also provide libraries which offer additional functionality such as pub/sub which you are likely to want and therefore have to implement yourself. I worked for Caplin Systems who built the Liberator product and it's a highly tuned software solutions built entirely to handle and solve this solution.

Also how different is Comet server side push from HTML5 web socket facility ?

Answer taken from here:

Comet is an umbrella term and there are many "Comet Servers" (see below) that use WebSockets as the transport mechanism when possible. Comet servers don't just use AJAX, XHR Long-Polling, Forever-Frame etc. They now use WebSockets and fallback to other transport mechanisms where required.

Here are just some of the "Comet Servers" that use WebSockets:

My principle objective is to build a variant of collaborative real time document editing facility.

I'd recommend that you don't try and implement a solution for Comet/WebSockets from scratch. It's a very well understood problem with a number of excellent solutions. And the solution still isn't simple to implement from scratch. The interesting problem you'll need to solve is one of state synchronisation across multiple clients so the great thing about these existing realtime technologies is that you can use them and concentrate on building your app.

Possibly also of interest:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...