用php驱动的网站实现Comet

用php驱动的网站实现Comet

本文介绍了用php驱动的网站实现Comet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想知道是否有人可以用一些简单的术语来解释我如何让从彗星开始。我在共享主机环境中。I wanted to know if somebody could explain in somewhat simple terms how I could getstarted with comet. I am on a shared host environment.我的可能性到底是什么?What exactly are my possibillity's?从这里我读到的内容Sofar认为php不是最佳选择,因为是每个请求一个进程运行,而不是在线程外运行。 另外,他们谈论套接字。From what I have read here sofar, is that php is not the best option., because it isrun as a one process per request instead off thread.On another, they talk about sockets.我也读过有关facebook的信息,他们在那里运行着用erlang编写的自己的彗星服务器,但是它们仍然有一个php网站。那么,那到底是如何工作的呢?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?我现在已经阅读了很多东西,但是在我的情况下到底有什么可能还是有点含糊。运行一个彗星服务器上的客户端的PHP脚本?这并不是说它如何保持持久的开放连接! (只是抛出其他帖子的一些评论)I have read alot off stuff now, but it is still a bit vague on what is actually possiblein 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)谢谢,理查德推荐答案您可以使用PHP重现Comet行为。就像您说的那样,PHP并不是最佳选择,因为仍然存在许多内存管理问题。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.但是对于小规模用途(低流量)PHP会正常工作。However for small scale purposes (low-traffic) PHP will work just fine.网络上有很多关于Comet的信息,以及如何将其与Python或Erlang等语言结合使用(由于它的最佳并发性,所以特别好)行为,但坦率地说,我对此了解不多。)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).如果您想尝试使用Python,SO上会有一个很好的问题/答案: Python Comet ServerIf you want to try out Python there's a good question/answer on SO:Python Comet Server 这篇关于用php驱动的网站实现Comet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-25 22:29