Firebase Cloud Messaging From .Net

In developing mobile web backends you might need users to broadcast messages such as push notifications to single or all  mobile subscribers from the cloud using services like Firebase Cloud Messaging (FCM).
 
In this article we will focus on sending push notifications from a .Net application using Firebase.Notification library. This library makes it very easy to send push notifications from Firebase using C#
 
You can get more information of the library here. You can also contribute here
 
To begin, download the library from Nuget:
  1. Install-Package Firebase.Notification -Version 1.0.0  
Using the library:

  1. using (var firebase = new Firebase())  
  2. {  
  3.     firebase.ServerKey = "{Your Server Key}";  
  4.     var id = "{Your Device Id}";  
  5.     firebase.PushNotifyAsync(id,"Hello","World").Wait();  
  6.     Console.ReadLine();  
  7. }         
Error Handling and Debugging

Trace errors in your output window, all errors from this library will be captured under the category Firebase.Notification for easy debugging,