How to effectively send push notifications to selected users in an app?

I am trying to implement a push notification server using nodejs and websockets. The server I'm trying to implement needs to be able to send notifications specific to each user in the application (ex: person commented on by your post, etc.). The server can also serve many applications. Therefore, the number of users using the service is very large.

The problem is how to manage the channels. I did some research on the internet and couldn't find a solid solution. This question also asks something like that. But he doesn't have hard answers.

One way I thought about implementing this is to have one channel per user, then it might not scale the server well for many users.

Another way I thought was to organize the same posts into groups and then create channels for the groups. Then the downside is a logged in user who has to subscribe to multiple channels, and there can also be many groups that only contain one user. On the other hand, the grouping process also affects efficiency.

My question is what is / is an effective method for solving this problem. Could you give me some idea of ​​this? Any help is appreciated. Thank.

+3


source to share


1 answer


One way I thought about implementing this is to have one channel per user, then it might not scale the server well for many users.

It depends on how the channels are implemented (themes, themes). If the subscription of each channel results in a new permanent connection, it won't scale too much. However, if the channels are presented at the protocol level, then it is beneficial for you to have one connection per client, and the technology will only process the routing of messages through the channels to the appropriate clients.

My question is what is / is an effective method for solving this problem. Could you give me some idea of ​​this? Any help is appreciated. Thank.

So, if you're using a solution that implemented PubSub over a single connection, scaling is much less of a problem (or doesn't become an issue quite quickly) and you can subscribe each user to their own notification channel. This is IMHO the best solution to this problem and something that is common practice.



Since you are looking at Node.js you might want to look at Faye - see channel subscription . You may also want to look at a hosted service like Pusher (I work) - see: Pusher Channels .

Web PubSub Security

The next consideration is security: how do you prevent any client from subscribing to the channel. The Faye docs provide a good overview of security , including a solution to the problem.

Pusher uses a user authentication mechanism and private channels which also provide a secure solution to this problem.

+3


source







All Articles