如何实现Facebook的通知? [英] how to implement facebook like notification?

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

问题描述

我正在尝试实施一个类似Facebook的直播通知系统,以便每当有人将他们添加为朋友时通知用户,例如他们的帖子或发表回复他们的评论。

I am trying to implement a Facebook-like live notifications system to notify users whenever someone adds them as friend, like their post or posts replies to their comments.

所有的数据库和PHP部分都完成了,但我不知道如何实现它像Facebook有。

All the database and PHP part is done, but I can't figure out how to implement it like Facebook has.

每当有人喜欢/评论你在Facebook上的信息时,浅蓝色框出现在屏幕的左下角。一旦有人在Facebook上点击按钮或发表评论,就会发生这种情况。我想知道我应该做什么来实现这个。

Whenever someone likes/comments on your post in Facebook the light blue box appears at the bottom left corner of the screen. This happens as soon as someone hits like button or posts comment in Facebook. I would like to know what I should do to implement this.

使用YUI或任何JavaScript框架我可以在 n 秒来检查通知。这个方法太重了

Using YUI or any JavaScript framework I can query a database table after n seconds to check for notifications. This method is too heavy.

我想知道是否有任何服务器端mod或脚本可以完成,以便每当我的数据库表中有新的通知条目时,服务器将告诉特定的客户端。这样一来,客户端到服务器的不必要的请求呼叫将被完全避免,系统可以一次有效地为网站上超过50,000个用户上网。

I was wondering if there is any server side mod or scripting can be done so that whenever there is new notification entry in my database table the server will tell that particular client. That way unnecessary request calls from client to server will be avoided completely and system can work efficiently for website with more than 50,000 users online at a time.

如何实现?

推荐答案

COMET 技术,例如 forever frame 教程)和长轮询。这可以让您拥有一种服务器 - >客户端推送通信的形式。

You should look into COMET techniques, such as forever frame (tutorial) and long polling. That allows you to have a form of a server->client push communication.

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

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