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:
- Notifying users that are currently connected and using my app - either web or mobile
- 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:
- 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 useAzure Notifications Hubfor users who are NOT in the active users list i.e. those who are NOT actively connected to my app. - Another approach would be to assume no one is connected. I could create an
Azure Functionsapp 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 callAzure Notifications Hubprocess 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!