Alerting a user when someone replies to their post

时间:2017-04-06 17:18:14

标签: node.js express

I have an application that allows users to submit posts and comment on other posts. Is it possible to alert the user when someone comments on their post using connect-flash? How else can I do this? I am using node.js and express and mongodb

1 个答案:

答案 0 :(得分:0)

您可以有两种方法:

  1. 在您的客户端,在某个时间范围内发出一些GET请求,并询问该帖子是否被评论

  2. (preffered)使用网络套接字(例如。Socket.IO),在客户端和服务器之间建立套接字,然后在评论帖子时,将该信息发送给客户端。

  3. 对于这两个选项,在客户端制作一些警报逻辑