I am wondering which is the best practice in Azure notification hub to send push notifications to a couple of certain users (e.g. about followed activities).
Imagine, users can follow other users and these followers should be notified about new activities (facebook, twitter principle).
How to send these notifications in detail, there are two options I am thinking about, but which one is the best?
1) looping through all desired users by code and calling SendTemplateNotificationAsync
for each individual user?
foreach(user in allSubscribedUsers) {
tags.Add("userid:" + userId);
await hub.SendTemplateNotificationAsync(notification, tags);
}
2) Having special tags a user can register to
registration.Tags = new HashSet<string>(deviceUpdate.Tags);
// the current user follows other users with the ids 1,2 and 3
registration.Tags.Add("followerUserid:1");
registration.Tags.Add("followerUserid:2");
registration.Tags.Add("followerUserid:3");
...
// an acivity by user with id 2 is happen
// send a push notification to all users who follow the user with id 2
tags.Add("followerUserid:2");
await hub.SendTemplateNotificationAsync(notification, tags);
It's possible that a user follows up to 1.000 other users, so he needs to register 1.000 of the followerUserId-Tag
.
Is the second approach a reliable solution?
Are there any tag limitations a user can register to?