List of all posts from this series: http://vunvulearadu.blogspot.ro/2014/11/azure-blog-post-marathon-is-ready-to.html
Short Description
Azure Notification Hub allow us to send notifications from any backend (hosted on cloud or on-premises) to our devices/clients.
I don’t know I you had the opportunity to work on a system that needs to work with different PNS providers (iOS, Android, WP), but managing all different platforms, tokens, trigger notification for each device of group of devices can be a time consuming task not only for developers but also for the person that trigger the notification.
For use cases like this Azure Notification Hub can become our best friend.
Main Features
Platform Agnostic
We can send notifications to any kind of device or system. From Android to iOS, to desktop application or even kindles.
Focus on content
Azure Notification Hubs enable us to focus on the content that we want to send to our applications and not on the notification system platform that we use. In this way we don’t care about the infrastructure and format of the notification that is send.
Scalable
With only one API call we can trigger a notification that is send to millions of devices across the glob.
Telemetry
This service has the capability to track notification. In this way, we ca know what is the status of each notification that was send, how many devices received it and so on.
Cross Platform
It has support for multiple platforms like iOS, Android, WP, desktop and even kindle.
No Integration development
There is no need to write custom code that integrates each PNS provider.
Xamarin Support
There is full support for Xamarin cross-platform applications.
Support for Registration from Device or from Backend
Both registration mechanism are supported in the current architecture of Azure Notification Hub. It is recommended to use the second one, because it allow us to update the tags (user subscriptions) on all devices that are registered for that user, not only on devices that are online.
Tags
To be able to send a notification to a specific device, tags needs to be used. Each device can have associated one or more tags. When a notification is send it is send to a specific tag. All devices that are registered with that specific tag will receive the notification.
We can see tags as a mechanism to group devices, but in in the same time we can have a tag that unique identify a registered device.
Tag Expression
We can send a notification that target a combination of tags. For this use causes we can define an expression based on AND, OR and NOT. For example we can send a notification for all people from UK and Germany that are interested to receives notification about Christmas.
Device Targeting
As we can saw above when we send a notification we can target a specific tag or a tag expression. There 3 ways to target a notification:
Templates
Because each device has a different notification platform with different functionalities, we need to a mechanism to specify different content based on device type and features. For example we may want to send a graphical image as a notification for devices that support this.
Templates allow us to specify a parameterized template for each device type. In this way the final content that will be received by a specific device will contain content that is supported by him.
This is a very powerful feature that you should use. More information about this can be found here http://msdn.microsoft.com/en-us/library/azure/dn530748.aspx
Security
The base mechanism that is used to manage access of different systems (that produce and send notification over the wire) is Shared Access Signature (SAS). Using SAS we can manage access of each system.
SAS is based on a token that can specify what kind of claims has each system. Below you can find the list of claims:
Scheduling
We are allowed to register a notification that will be send at a specific time in future. In this way we can send notifications to our clients at a specific time.
Import/Export
We can export or import a bulk of registrations. In this way we can automatically manage the devices that are registered.
Limitations
There are some limitation related to notification size, tag name and so on, but this are not real limitations.
For the Free and Basic tier there is also a limitation at the number of tags, devices registered with the same tag and so on. All this limitation are removed if you are using Standard tier that allow us to nock yourself out.
Applicable Use Cases
Below you can find some use cases when I would use Azure Notification Hub
Discounts notification
If you have a store and every day or week you have special discounts, that you can use this notification system to notify users about special offers and discounts. Combined with scheduler support, you can setup your discounts offers in advance.
Breaking news
For application that share content and news to clients, a system like this can be used with success to send breaking news notification to users.
Alerts
Notification Hub can be used by applications that needs to send alerts to users when something is happening in their region. For example alerts can be used to send notifications when the risk level in a specific region was changed or a natural calamity will happen.
Code Sample
Pros and Cons
Pros
Cons
-
Pricing
When you calculate the cost of Azure Notification Hub you should take into account the following:
Conclusion
Azure Notification Hub is design to any type of application and customer. From the small one that has a limited budget to the large one that needs strong SLAs and features like import/export. This is a service that you should keep in mind and use it when you need to send notifications.
Short Description
Azure Notification Hub allow us to send notifications from any backend (hosted on cloud or on-premises) to our devices/clients.
I don’t know I you had the opportunity to work on a system that needs to work with different PNS providers (iOS, Android, WP), but managing all different platforms, tokens, trigger notification for each device of group of devices can be a time consuming task not only for developers but also for the person that trigger the notification.
For use cases like this Azure Notification Hub can become our best friend.
Main Features
Platform Agnostic
We can send notifications to any kind of device or system. From Android to iOS, to desktop application or even kindles.
Focus on content
Azure Notification Hubs enable us to focus on the content that we want to send to our applications and not on the notification system platform that we use. In this way we don’t care about the infrastructure and format of the notification that is send.
Scalable
With only one API call we can trigger a notification that is send to millions of devices across the glob.
Telemetry
This service has the capability to track notification. In this way, we ca know what is the status of each notification that was send, how many devices received it and so on.
Cross Platform
It has support for multiple platforms like iOS, Android, WP, desktop and even kindle.
No Integration development
There is no need to write custom code that integrates each PNS provider.
Xamarin Support
There is full support for Xamarin cross-platform applications.
Support for Registration from Device or from Backend
Both registration mechanism are supported in the current architecture of Azure Notification Hub. It is recommended to use the second one, because it allow us to update the tags (user subscriptions) on all devices that are registered for that user, not only on devices that are online.
Tags
To be able to send a notification to a specific device, tags needs to be used. Each device can have associated one or more tags. When a notification is send it is send to a specific tag. All devices that are registered with that specific tag will receive the notification.
We can see tags as a mechanism to group devices, but in in the same time we can have a tag that unique identify a registered device.
Tag Expression
We can send a notification that target a combination of tags. For this use causes we can define an expression based on AND, OR and NOT. For example we can send a notification for all people from UK and Germany that are interested to receives notification about Christmas.
(( UK || Germany ) && Christmas)
Device Targeting
As we can saw above when we send a notification we can target a specific tag or a tag expression. There 3 ways to target a notification:
- Tags
- Tag Expression
- Broadcast (all devices that are registered in Notification Hub will receive the notification)
Templates
Because each device has a different notification platform with different functionalities, we need to a mechanism to specify different content based on device type and features. For example we may want to send a graphical image as a notification for devices that support this.
Templates allow us to specify a parameterized template for each device type. In this way the final content that will be received by a specific device will contain content that is supported by him.
This is a very powerful feature that you should use. More information about this can be found here http://msdn.microsoft.com/en-us/library/azure/dn530748.aspx
Security
The base mechanism that is used to manage access of different systems (that produce and send notification over the wire) is Shared Access Signature (SAS). Using SAS we can manage access of each system.
SAS is based on a token that can specify what kind of claims has each system. Below you can find the list of claims:
- Listen (Create, Read, Delete Registrations)
- Send (Send Notifications)
- Manage (Create, Read, Update, Delete Notification Hubs, Read registration by tag)
Scheduling
We are allowed to register a notification that will be send at a specific time in future. In this way we can send notifications to our clients at a specific time.
Import/Export
We can export or import a bulk of registrations. In this way we can automatically manage the devices that are registered.
Limitations
There are some limitation related to notification size, tag name and so on, but this are not real limitations.
For the Free and Basic tier there is also a limitation at the number of tags, devices registered with the same tag and so on. All this limitation are removed if you are using Standard tier that allow us to nock yourself out.
Applicable Use Cases
Below you can find some use cases when I would use Azure Notification Hub
Discounts notification
If you have a store and every day or week you have special discounts, that you can use this notification system to notify users about special offers and discounts. Combined with scheduler support, you can setup your discounts offers in advance.
Breaking news
For application that share content and news to clients, a system like this can be used with success to send breaking news notification to users.
Alerts
Notification Hub can be used by applications that needs to send alerts to users when something is happening in their region. For example alerts can be used to send notifications when the risk level in a specific region was changed or a natural calamity will happen.
Code Sample
// Send notification at a specific time
Notification notification = new AppleNotification("{\"aps\":{\"alert\":\"Special discount ony for you!\"}}");
var scheduled = await hub.ScheduleNotificationAsync(notification, new DateTime(2014, 12, 24, 10, 0, 0));
Pros and Cons
Pros
- Scalable
- Template support allow us to use features that are specific for each platform
- Simple to use
- Telemetry support
- Free tier is great for start-ups and is FREE.
Cons
-
Pricing
When you calculate the cost of Azure Notification Hub you should take into account the following:
- Number of notification that will be send per month
- Number of tags
- Number of devices registered with the same tag
- Scheduler support
Conclusion
Azure Notification Hub is design to any type of application and customer. From the small one that has a limited budget to the large one that needs strong SLAs and features like import/export. This is a service that you should keep in mind and use it when you need to send notifications.
Comments
Post a Comment