php中类似facebook的通知系统 [英] A facebook-like-notification system in php

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

问题描述

我怎样才能建立一个类似 facebook 的通知系统:- 用户 A 向用户 B 写一条消息- 数据库上的侦听器将消息路由到 userB- 在userB界面,消息立即出现

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.

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

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