节点js + mysql推送通知 [英] node js + mysql push notification

查看:80
本文介绍了节点js + mysql推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究要给我像Facebook这样的通知的项目.也就是说,当某人在其他个人资料上发表评论或喜欢其他个人资料上的任何链接时.我想使用nodejs进行实时推送通知.

I am working on project where I want to give notification like facebook. i.e. when someone comments on others profile or like any link on others profile. I want to use nodejs for real time push notification.

这些评论,喜欢的数据通过ajax请求或通过将表单发布到php来存储在通知表"中的mysql数据库中.保持监视文件并在文件更新时发出通知.

These data of comments, likes are stored in the mysql database in "Notification table" via ajax request or by posting the form to php.I found many tutorials of nodejs on net for the real time push notifications but unfortunately they talk about keeping watch on file and emits the notification when file is updated.

没有人知道如何监视mysql表,因此只要在表中插入任何数据,它就会发出通知.我没有得到应该在nodejs中编写什么样的代码的任何方式.

does anybody knows how to keep watch on the mysql table, so whenever, any data is inserted in the table, it emits the notification. I am not getting any way what kind of code I should write in nodejs.

如果需要更多说明,请告诉我.

Please let me know if more explanation is needed.

先谢谢了.

推荐答案

您可以将node.js与mysql库一起使用,以轮询数据库中的新通知,我认为这是您要尝试的操作.我从未亲自完成过特定任务,但我知道这是可以实现的.

You can use node.js with a mysql library to poll your database for new notifications, which I think is what you're trying to do. I've never done that specific task personally, but I know it's achievable.

关于需要编写哪种代码,请尝试查找节点中间件教程",其中可能会有一些变体,包括在搜索查询中包含MySQL,并且至少会找到您要寻找的内容的想法.

In terms of what kind of code you need to write, try looking up "Node Middleware Tutorials" with perhaps some variations that include MySQL in the search query and you'll find at least an idea of what you should be looking for.

如果可以的话,我将使用更具体的代码示例更新此答案,以使您朝正确的方向前进.

If I can I will update this answer with more specific code samples to get you moving in the right direction.

这篇关于节点js + mysql推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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