Long polling in Laravel (sleep() function make application freeze)

最后都变了- 提交于 2019-12-04 04:45:39

Actually it is not long polling if you use bonez code. Long polling is if the connection stays opened (maybe with a timeout) until the server sends a response. If the client sends every 2 seconds a request and gets a response, it is just polling and you get the server response 2 seconds late in the worst case. With long polling you don't have this delay.

The freezing problem is no error with Laravel. The session blocks. So use session_write_close(); before calling the long polling method or use the cookie session driver. For more information please see http://konrness.com/php5/how-to-prevent-blocking-php-requests/

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