There are tons of push management systems out there - Azure Notification Hubs, Amazon SQS, OneSignal, Firebase, etc, but what if you want to run this stuff local? That also exists - PushSharp and others exist in the .NET ecosystem.
Currently, this library supports Apple Notifications and Google Firebase Messaging. It is important you understand the native API’s before using this library
However, there is a bunch of things that they don’t offer
General purpose push notification abilities
Management of the registration base (tokens, which user owns the token, etc)
From the sender base, they lack a lot of deep customization
What if I just want to hit the base OS providers without the middle man?
Shiny.Extensions.Push looks to solve all of these issues.
Register a Device/User
Now that we’ve registered our push management components, we can assume they we will be injecting Shiny.Extensions.Push.IPushManager wherever we need it.
Sending a Push
Sending a push cross platform, couldn’t be easier (or more powerful)
Managing Users
The push notification abstractions at their core are a minor part of this library. The main “features” are the ones that manage not only the push tokens, but also the user tagging and general tags that don’t come out of the box for all push providers like Apple.
Register Users
Unregister All Users
Sending a Push
Sending allows you to not only provide a fully set notification, but also provide a rich set of criteria for who to send to
Querying
This is the exact same criteria as used by send, but obviously, without the sending :)
Notification Reporters
Notifications are often sent in “batches” depending on how wide your notification search parameters are.
Reporters offer you a way of:
Tracking Errors on a specific notification to a device
Tracking when the batch begins and how many devices are going to be sent for processing
Creating a Reporter
First thing to do, is implement the Shiny Notification Reporter interface like so:
[!NOTE]
You can also use the Shiny.Extensions.Push.NotificationReporter class and use override instead of implementing the entire interface.
[!NOTE]
You can have multiple reporters
Next thing to do is register this with the extension during startup
[!WARNING]
The reporter is registered as a singleton
[!WARNING]
It isn’t good to do a lot of logic inside notification error or notification success as they run per notifcation in a batch. It is better to use OnBatchStart and OnBatchCompleted to process. This will allow your notification batches to finish quicker.
Out of the Box Reporters
BatchTimeNotificationReporter - this will log how long a batch takes to process. You can use this to tune your queries or even determine that you may need to move your push functions to a more resilient platform like Azure Functions instead of directly in your Web API.
AutoCleanupNotificationReporter - This reporter will remove any notification errors that occur because no notification was sent. This usually means the user uninstalled your app (therefore never unregistered using your app) or has unregistered from notifications but it never hit your server. It happens. This will catch the exceptions and unregister the device for you. To Setup, use the following during the extension registration