PHP:将数据从服务器推送到客户端的最佳方式.....

Pus*_*dra 10 php zend-framework client-server

在我的项目I need to push some data from server to the clientfacebook不会,如果some updates are performed in the clients profile像有人在客户端的墙上写的东西,Facebook的自动推送到客户端.

目前I am using AJAX要持续check the DB for the updates.那是not a good practice.

我不想依赖客户端进行更新.我希望在server should automatically push the data to the client side执行与客户端相关的某些更新时.

请建议一些网址或示例代码......

提前致谢.....

Cha*_*eaf 12

您应该看一下APE项目,该项目支持多种变体,这些变体尽可能接近Push,例如长轮询,XHRStreaming和WebSockets.

编辑 只在PHP中执行此操作并不是最佳选择,因为它占用了大量资源来保持所有这些连接的活动.