Need help with comet, and what to choose

笑着哭i 提交于 2019-12-01 10:35:38

问题


I'm new to comet, but I have read about it and I realize that PHP is bad for comet long polling.

All of my project is written in CodeIgniter PHP Framework, so all my code is PHP. But I need request data all seconds to update auctions products, and I'm looking for comet, but as PHP is a bad way to comet, how can I do it?

also it is possible to read from MySQL and send to listener?

Thanks.


回答1:


One solution is Ajax Push Engine - they dish out their own server for handling the connections with clients, but you can use whatever backend to feed data to APE - including PHP. You can also work with MySQL directly - see example one and two. Note: the APE server can only be run on Linux, BSD or Mac OS X (though, it would seem that a port to Windows should be possible, since it's written in pure C, AFAICT).

The other one is NGiNX_HTTP_Push_Module - you use nginx as your push server (no need for an extra server running, like it's in APE's case) and the protocol is easy to work with/straightforward IMHO.




回答2:


Another options would be a hosted comet SaaS solution, such as WebSync On-Demand. It's cheap, and because it's hosted doesn't have server requirements.

There's a PHP SDK for integrating your data push.

[Disclaimer: I work there]



来源:https://stackoverflow.com/questions/2345481/need-help-with-comet-and-what-to-choose

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