类似于Facebook的通知系统在PHP [英] A facebook-like-notification system in php

查看:100
本文介绍了类似于Facebook的通知系统在PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能制定一个类似Facebook的通知系统:   - 一个用户A写一条消息到用户B   - 对数据库的路线侦听消息到用户B   - 在用户B接口,瞬间出现消息

How can I put in place a facebook-like-notification system: - A userA writes a message to the userB - A listener on the database routes the message to the userB - On the userB interface, the message appears instantly

如何才能做到这一点在PHP?

How can I do that in php?

非常感谢你,

问候

推荐答案

我不会建议使用两种轮询或试图实现使用PHP推的解决方案,如果你打算有任何可观的流量。什么情况是,最终所有的PHP进程被阻塞,然后你就不能成为了Web请求。

I wouldn't advise using either polling or trying to implement a push based solution using PHP, if you are going to have any sizable traffic. What happens is that eventually all the PHP processes get blocked, and then you can't serve anymore web requests.

查找到的node.js,cometd或其他推送的解决方案。如果你需要的东西简单,需要得到快速启动和运行,我建议 http://pusherapp.com/ 。他们有一个PHP客户提供超级简单的API。

Look into node.js, cometd or another push based solution. If you need something simple and need to get up and running quickly, I'd recommend http://pusherapp.com/. They have a PHP client available and super simple API.

这篇关于类似于Facebook的通知系统在PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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