TsgcWebPush_Client

The TsgcWebPush_Client is a class that allows you to send a notification once you obtain the subscription details.

Introduction

The TsgcWebPush_Client is a class that allows you to send a notification once you obtain the subscription details. 

 

Find below an example of using the WebPush client to send a notification given an endpoint, public key and authentication secret from a WebPush subscription.

 


    public void SendWebPushNotification()
    {
        var oSubscription = new TsgcHTTP_API_WebPush_PushSubscription();
        oSubscription.Endpoint = "endpoint";
        oSubscription.PublicKey = "public key";
        oSubscription.AuthSecret = "authentication secret";
        var oWebPush = new TsgcWebPush_Client();
        oWebPush.VAPID.PEM.PrivateKey.Text = "private_key_pem";
        oWebPush.VAPID.DER.PrivateKey = "private_key";
        oWebPush.VAPID.DER.PublicKey = "public_key";
        oWebPush.SendNotification(oSubscription, "{\"title\": \"eSeGeCe Notification\", \"body\": \"Hello from eSeGeCe!!!\"}");
    }
    

 

Reference