views:

220

answers:

3

Hello, I wanted to know if somebody could explain in somewhat simple terms how I could get started with comet. I am on a shared host environment.

What exactly are my possibillity's?

From what I have read here sofar, is that php is not the best option., because it is run as a one process per request instead off thread. On another, they talk about sockets.

I have also read about facebook and that they run there own comet server written in erlang, but they still have a php website. So how exactly does that work then?

I have read alot off stuff now, but it is still a bit vague on what is actually possible in my situation. Running a php script that is a client off a comet server?? That is not saying how it keeps a longlasting open connection! (just throwing in some comments from other posts)

thanks, Richard

+2  A: 

You can use PHP to reproduce the Comet behavior. Like you said PHP isn't the best choice because of a lot of memory management issues that are still widely there.

However for small scale purposes (low-traffic) PHP will work just fine.

There's a lot of information on the web about Comet and how to use it with languages such as Python or Erlang (especially good because of its optimal concurrency behavior, but frankly I don't know much about it).

If you want to try out Python there's a good question/answer on SO: http://stackoverflow.com/questions/960969/python-comet-server

Luca Matteis
Facebook's gui is written in PHP (they probably only use the templating engine) but it doesn't mean their Chat stuff is. You can use the language that is most appropriate for the job, they chose Erlang, you can choose anything else, you don't have to rewrite your site.
Luca Matteis
thanks, thats why I put the facebook comment in it, because that seemed to contradict the general opinion about php. Another thing is the use off flash, but that's not really what I wanted to pursue. If you talk about other languages, then that would imply that I rewrite the whole php-mysql website in another language, or not?
Richard
sorry, I am confusing myself now. So asking a php script to open a longlasting connection is not the way to go, because the php engine is not optimized for this kind off usage. So, is it then possible to make an ajaxcall to get to the cometserver somehow, and avoiding the use off php? in other words, step off to some java or python script. Ok, now I officially don´t know what I am talking about anymore. How do you get to some other language and use it in the php site?
Richard
+2  A: 

Check my question too...

Sinan Y.
Thanks, without reading all the links in it. It suggests some configuring is neccesary on the webserver. I don´t know how far you had to go, but I am on a shared host. In that respect my options are limited, I think. On a sidenote, did you get it all up and running to your satisfactory?
Richard
i tried meteor on own server environment and works fine, couldn't try the others, but as far as i get from other comments you need a chat on your page, for that you dont need to have comet just make frequent calls and collect responses and update your chat messages on browser. This sounds like traffic intensive operation but if it is a low traffic webpage it won't make too big difference.
Sinan Y.
+2  A: 

A simple solution is to find a SaaS comet provider, such as the one we host at Frozen Mountain, WebSync On-Demand. Basically, it'll let you use our servers (running WebSync + IIS) to handle the long lived connections, but allow you to publish your messages via PHP, and pre-process your messages in PHP. If you're going to have < 10 simultaneous users, it's free, so for a small site it should do exactly what you need.

jvenema