PHP:将数据从服务器推送到客户端的最佳方式? [英] PHP : Best way to push data from server to clients.....?

查看:353
本文介绍了PHP:将数据从服务器推送到客户端的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目我需要推送一些数据从服务器到客户 facebook c $ c>某些更新在客户端配置文件中执行,像某人在客户端的墙上写东西,Facebook自动将其推送到客户端。



目前我使用AJAX 连续检查数据库的更新。这是不是一个好的做法



我不想依赖客户端进行更新。我想在与客户端相关的一些更新执行时,服务器应该自动将数据推送到客户端



请提供一些网址或示例代码来实现此功能...



提前感谢.....


<你应该看看APE项目,它支持多种变化,就像你会得到的,像长轮询,XHRStreaming和WebSockets接近Push。






在PHP中执行此操作不是最好的选择,因为它需要大量资源来保持所有这些连接。


In my project I need to push some data from server to the client like facebook does, when some updates are performed in the clients profile like somebody writes something in the wall of the client, Facebook automatically push it to the client side.

Currently I am using AJAX to continuously check the DB for the updates. That is not a good practice.

I don't want to depended on the client side for the updates. I want that the server should automatically push the data to the client side when some updates are performed related to the client.

Please suggest some url or sample code to do so......

Thanks in advance.....

解决方案

You should take a look at the APE Project, which supports multiple variations that are as close to Push as you will get, like long-polling, XHRStreaming and WebSockets.

edit Doing this in just PHP is not the best choice, as it takes up a lot of resources to keep all those connections alive.

这篇关于PHP:将数据从服务器推送到客户端的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆