implement comet with php driven website

时光总嘲笑我的痴心妄想 提交于 2019-12-11 13:41:45

问题


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


回答1:


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: Python Comet Server




回答2:


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.



来源:https://stackoverflow.com/questions/1633793/implement-comet-with-php-driven-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!