使用socket.io node.js和传入消息的通知系统的体系结构实现和设计

时间:2022-08-26 18:39:54

Disclaimers

免责声明

  • I have not worked with node.js before
  • 我之前没有使用过node.js.
  • I have not used socket.io before
  • 我之前没有使用过socket.io.

I'm looking at implementing a Google Plus, Facebook, * 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.

我正在考虑实施Google Plus,Facebook,*风格的通知系统。我不是一个没有经验的开发人员,最终我会想到这一点,但我只是想向正确的方向发展。

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.

现在,我的所有消息都是从几十个不同的来源中检索出来的。

  • A message can be entered via an API by third parties
  • 可以通过第三方通过API输入消息
  • Message are pulled from Send Grid
  • 消息从发送网格中提取
  • Messages can be sent via private message Controllers.
  • 消息可以通过私人消息控制器发送。
  • Etc etc
  • 等等

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.

我想要的是有一种方法能够在收到新消息时通知用户。我很乐意以任何方式重构我的代码,这使我可以在收到插入消息时通知我的node.js,如果这是我需要做的。

But I am just not quite sure where to start.

但我不太确定从哪里开始。

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中,我的Insert语句在很多方面都有。所以我只是不知道最好的方法。

Thanks.

谢谢。

1 个解决方案

#1


14  

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".

尝试查看演示文稿为什么数据库很糟糕,这就是为什么不应该使用MySQL等数据库进行消息传递。消息传递和通知系统适用于事件驱动架构,我建议观看此演示文稿或从此处了解有关此主题的更多信息,以便更好地了解事件驱动的“生态系统”。

#1


14  

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".

尝试查看演示文稿为什么数据库很糟糕,这就是为什么不应该使用MySQL等数据库进行消息传递。消息传递和通知系统适用于事件驱动架构,我建议观看此演示文稿或从此处了解有关此主题的更多信息,以便更好地了解事件驱动的“生态系统”。