A facebook-like-notification system in php(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的通知系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:php中类似facebook的通知系统


- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- Laravel 仓库 2022-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01