2011-04-22 89 views
10

在我的项目I need to push some data from server to the client就像facebook一样,当some updates are performed in the clients profile像有人在客户墙上写东西时,Facebook会自动将其推送到客户端。PHP:将数据从服务器推送到客户端的最佳方法.....?

当前I am using AJAX连续check the DB for the updates。那是not a good practice

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

请推荐一些网址或代码示例这样做......

在此先感谢.....

+3

您正在寻找[推送技术](http://en.wikipedia.org/wiki/Push_technology)。有许多实现,请检查对您有用的东西。 – Khez 2011-04-22 08:34:32

回答

1

你可以用Node.js的:http://nodejs.org/

+1

您手头上有一个推送示例的链接? – hakre 2011-05-16 09:42:59

+1

@hakre [here you are](http://www.gianlucaguarini.com/blog/nodejs-and-a-simple-push-notification-server/) – Robert 2013-10-29 01:56:12

0

你需要的是一个彗星/ websocket的方法,我不知道任何PHP彗星实现/框架,但是当你搜索它时,网络上有几个例子。

相关问题