Long Polling with PHP on Apache

南笙酒味 提交于 2019-11-30 13:42:56

This sounds like continuations. You can definitely not do this in PHP, in any elegant way. If you want to do this, your best chance would be to save the current state, and write the code in such a way that you can resume from where you left off when you load the state.

I don't think there is a solution. You can't distinguish a polling request from a normal request. Only avoid Apache that could help (e.g. running nginx on 80, forward all requests to Apache on 81, except polling requests).

I also don't think you have a problem. Nginx or other server is not much more efficient than Apache. Polling is a PHP request, Apache with mod_php is less or more a good choice. Nginx won't use less resource than Apache in serving PHP.

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