Facebook 如何保存并生成通知并向我们显示?

发布于 2024-11-14 07:09:29 字数 272 浏览 2 评论 0原文

自从我开始我的网络编程以来,我一直在想一个问题...facebook如何非常非常动态...然后慢慢了解了Javascript,PHP,jquery等强大工具的功能...但我从未摆脱过与通知生成相关的问题......即当我们在其他人的墙上或个人资料上做一些事情(例如发帖)时;正在完成某件事的通知可以直接到达用户页面......但实际上是什么让通知被读取?是用于检索信息的数据库注入还是更可能用于 XML 读取的内容?有人能回答我真正的原因吗?

实时通知是通过彗星完成的。我读了这篇文章并理解了,但是如何读取通知呢?

Ever Since I had started my web-programming, I was always on a question... how is facebook very very dynamic... then slowly understood the capabilities of powerful tools like Javascripts, PHP, jquery and so on... But I never got out of a question related about the notification generation.... i.e. when we do something on others wall or profile like postings; the notification of something being done is straight-forward to reach the user's page ... but what actually makes the notifications read?? Is it a database injection for retrieving the information or something more likely to XML-reading?? Can anybody answer me just the actual factor for that?

The real-time notification is done through the comet .. I read the article and understood but what about getting the notifications read?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小情绪 2024-11-21 07:09:29

我不知道我是否收到你的问题。但如果你想知道,你是如何得知别人采取的涉及你的行动(例如在你的墙上写一些东西),我可以给你我个人的猜测。

每当有人做了一些影响其他人的事情时,Facebook 都会有一些机制来生成通知(非常基本)。

您从 Facebook 打开的每个页面都会定期向 Facebook 发送“有什么新鲜事?”Ajax 请求。

如果有新的内容,该请求会获取该信息,然后在客户端进行处理。

BAM - 魔法很容易。

如果这不是您的问题,请随时解释一下^^

I dont know, if i get your question. But if you are wonderuing, how you are informed about an action someone else takes, that involves you (e.g. writes something on your wall), i can give you my personal guess.

Whenever someone does something, that affects someone else, facebook has some mechanisms to generate the notifications (quite basic).

Every page you have open from facebook regularly sends a "whats new?"-Ajax request to facebook.

If there is something new, this request gets this information, which is then processed on client-side.

BAM - MAGIC can be easy.

If this was not your question, feel free to explain ^^

花想c 2024-11-21 07:09:29

Facebook 不共享其代码,因此人们只能对其如何共享通知做出有根据的猜测。但是,如果您想说,重复他们正在做的事情,我会使用事件驱动模型。

你已经说过你知道他们使用 Comet。这为他们提供了从客户端到服务器的持续连接,该连接可以在服务器上注册为侦听器。当另一个客户端更新页面上的某些内容时,将触发一个事件,侦听器将拾取该事件并更新页面。无需数据库交互。

Facebook does not share its code, so one can only make educated guesses as to how its sharing its notifications. However if you wanted to say, duplicate what they are doing I would use an event driven model.

You already said that you know they use Comet. What that gives them is a constant connection from a client to to the server, this connection can just be registered as a listener on the server. When another client updates something on the page, an event will be fired, the listener will pick it up and update the page. No DB interaction needed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文