title: C# build server side ios push notification
body: <p>I am .net developer making server side library to push notification on <strong>IOS client application</strong>  using FCM firebase cloud messaging using this code.</p>
  
  <pre><code>    {
          WebRequest tRequest = WebRequest.Create("https://fcm.googleapis.com/fcm/send");
          tRequest.Method = "post";
          tRequest.ContentType = "application/json";
          var objNotification = new
          {
              **to = "Registration token ",**
              notification = new
              {
                  title = "hi",
                  body = "FCM correct token tab closed"
              }
          };
          string jsonNotificationFormat = Newtonsoft.Json.JsonConvert.SerializeObject(objNotification);
  
          Byte[] byteArray = Encoding.UTF8.GetBytes(jsonNotificationFormat);
          tRequest.Headers.Add(string.Format("Authorization: key={0}", "server-key"));
          tRequest.Headers.Add(string.Format("Sender: id={0}", "sender id"));
          tRequest.ContentLength = byteArray.Length;
          tRequest.ContentType = "application/json";
          using (Stream dataStream = tRequest.GetRequestStream())
          {
              dataStream.Write(byteArray, 0, byteArray.Length);
  
              using (WebResponse tResponse = tRequest.GetResponse())
              {
  
                  using (Stream dataStreamResponse = tResponse.GetResponseStream())
                  {
                      using (StreamReader tReader = new StreamReader(dataStreamResponse))
                      {
                          String responseFromFirebaseServer = tReader.ReadToEnd();
  
                          FCMResponse response = Newtonsoft.Json.JsonConvert.DeserializeObject&lt;FCMResponse&gt;(responseFromFirebaseServer);
                          if (response.success == 1)
                          {
                              Console.WriteLine("Message was sent successfully");
  
                          }
                          else if (response.failure == 1)
                          {
                              Console.WriteLine(string.Format("Error sent from FCM server, after sending request : {0} , for following device info: {1}", responseFromFirebaseServer, jsonNotificationFormat));
  
                          }
  
                      }
                  }
  
              }
          }
      }
  </code></pre>
  
  <p>How could  I retrieve <strong>Registration token</strong> from FCM before send notification and use it to push notification ?</p>
  
  <p>Thanks..</p>