本文介绍了如何实现像Facebook的通知介绍CakePHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确实有人知道如何实现类似Facebook的通知?这个想法是把通知在平行于无刷新该网站数据库中所做的更改标签?如果一个数据被添加到数据库中,该网站应反应就可以了。谢谢你..干杯!

does somebody knows how to implement facebook like notification? the idea is to put notification on the tabs parallel to the changes made in the database without refreshing the site? if a data is added to the database, the site should react on it. thank you.. cheers!

推荐答案

Facebook的风格通知正在使用的如彗星服务器或WebSocket的服务器。它可以直接添加此功能集成到一个PHP应用程序,但它被广泛认为PHP不处理持久性/长期持有的连接非常好(不会比例)。如果你仍然想在这里举办自己的实时PHP的解决方案有一些资源:

Facebook style notifications are achieved in web applications using realtime web technologies such as Comet servers or WebSocket servers. It is possible to add this functionality directly into a PHP application but it's widely agreed that PHP doesn't handle persistent/long-held connections very well (it won't scale). If you still want to host your own realtime PHP solution here are a few resources:

  • StackOverflow question about AJAX PHP Push
  • phpwebsocket
  • Start using HTML5 WebSockets today
  • php-websocket
  • How to implement Comet in PHP

不过,我建议你看一下href="http://www.leggetter.co.uk/real-time-technologies-guide#hosted-services">托管解决方案一个 SO质疑>

However, I'd recommend you look at a hosted solution (I work for one such company) which means all you need to do is make a HTTP call to a RESTful API and embed a JavaScript library within your application to achieve your push notifications. More information why I recommend using a hosted service in this SO question on Apache and Comet

这篇关于如何实现像Facebook的通知介绍CakePHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-10 20:27