使用socket.io node.js和传入消息的通知系统的体系结构实现和设计 [英] Architecture Implementation and Design for a Notification System using socket.io node.js and incoming messages

查看:90
本文介绍了使用socket.io node.js和传入消息的通知系统的体系结构实现和设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

免责声明

  • 我以前从未使用过node.js
  • 我以前没有使用过socket.io

我正在考虑实施Google Plus,Facebook,StackOverflow样式通知系统.我不是一个没有经验的开发人员,最终我会弄清楚这一点,但我只是在寻找朝着正确方向发展的方向.

I'm looking at implementing a Google Plus, Facebook, StackOverflow style notification system. I'm not an inexperienced developer, and eventually I will figure this out, but I'm just looking for a thrust to the right direction.

我想要的是正在浏览我的网站的用户在收到新消息时在浏览会话期间收到通知的信息.

What I want is for users who are browsing my site to be notified during their browsing session when they receive a new message.

当前,我所有的消息都存储在一个表中.

Currently, all of my messages are stored in a single table.

  |  id    | messageSubject   | messageBody     | hasRead   | readDate   | sentDate   | sentToUser  | sentFromUser  |
  |   1    |   HelloWorld     | Nada            |   0       | `null`     | `null      |      1      |      10       |

现在,我所有的邮件都是从不同来源的数十个中检索到的.

Now, all of my messages are retrieved from dozens of different sources.

  • 第三方可以通过API输入消息
  • 邮件是从发送网格"中提取的
  • 可以通过私人消息控制器发送消息.
  • 等等等等

我想要的是一种能够在收到新消息时通知用户的方法.我很高兴以任何方式重构我的代码,以便在需要时收到插入消息时通知我的node.js.

What I want is to have a way to be able to notify users when a new message is received. I'm happy to refactor my code any way which makes it possible to notify my node.js when I receive a insert a message if that is what I need to do.

但是我不太确定从哪里开始.

But I am just not quite sure where to start.

我的问题是我所有的消息都是通过许多不同的来源输入到mysql的,我的Insert语句在很多领域.所以我只是不知道最好的进行方法.

My problem is that all of my messages are entered into mysql through dozens of different sources, my Insert statements are in a lot of areas. So I just don't know the best way to proceed.

谢谢.

推荐答案

尝试查看演示文稿为什么数据库吸引消息传递,这就是为什么您不应该使用MySQL之类的数据库进行消息传递的原因. 消息,通知系统与此处此处了解有关此主题的更多信息以便对事件驱动的生态系统"有一个更全面的了解.

Try to look at presentation Why databases suck for messaging which is namely about why you shouldn't use databases such as MySQL for messaging. Messaging and notifications systems works well with Event Driven Architecture and I would recommend to watch this presentation or to learn more on this topic from here in order to get a bigger picture about event driven "ecosystem".

这篇关于使用socket.io node.js和传入消息的通知系统的体系结构实现和设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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