Notifications for inactive users

Viewed 15

I’m implementing a solution that will notify users in a scenario very similar to a chat.

I’ll be using SignalR and Azure Notifications Hub for the job.

There are two scenarios that I need to address:

  1. Notifying users that are currently connected and using my app - either web or mobile
  2. Notifying users who are NOT currently using the app

I think SignalR will work just fine for the first scenario which is fairly easy.

My question is handling the second scenario which will require Azure Notifications Hub.

In a typical chat app, though it’s not real-time, there’s little delay before an inactive user receives a notification for a new message he receives.

How do I “trigger” a process that will send a notification through Azure Notifications Hub?

I can think of two ways to handle this:

  1. Figure out a way to keep a list of users who currently have an active connection to my app. These users can be notified through SignalR. So after each new message, I could trigger a notification process that will use Azure Notifications Hub for users who are NOT in the active users list i.e. those who are NOT actively connected to my app.
  2. Another approach would be to assume no one is connected. I could create an Azure Functions app that runs every minute to check on messages that are NOT opened. It would then compile a list of users who need to be notified and call Azure Notifications Hub process to notify them.

I don’t want to reinvent the wheel and want to tap into the experience of those who’ve already implemented a solution like this.

I’m currently leaning towards the second approach. I’d appreciate your suggestions, especially on approaches that I haven’t thought of. Thanks!

0 Answers
Related