Reputation: 67
I am working on a new project in which we have tiny social networking feature, where each user has an ability to post/share quotes, and more over facility of like and comment.
so, i want to build a (user specific )realtime push notification module with nodejs.
Upvotes: 2
Views: 5683
Reputation: 362
Yea. You can use Socket.io. In system , you can store the uses have connection to system. After you can check available users, if user available then you send (emit) to user with channel is socket.id.
Upvotes: 0
Reputation: 41
I'm not sure what your question is exactly- or what specific problem you're trying to solve, but gave my thoughts on a similar question here.
See Server Sent Events.
Upvotes: 1
Reputation: 727
You can use socket to do so. What you can do is create a userList array on server who are online in the system. The userList will contain user information along with the socket id.
When a particular event occurs you know to whom to send that notification, and then check if all those users are available in the userList. If a user is available in the userList, use socket to emit the notification to that users.
Upvotes: 7