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的通知系统


基础教程推荐
- 在多维数组中查找最大值 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01