TsgcWebPush_Client, abonelik ayrıntılarını edindikten sonra bir bildirim göndermenize olanak tanıyan bir sınıftır.
TsgcWebPush_Client, abonelik ayrıntılarını edindikten sonra bir bildirim göndermenize olanak tanıyan bir sınıftır.
Bir WebPush aboneliğinden bir uç nokta, genel anahtar ve kimlik doğrulama gizli anahtarı verildiğinde bir bildirim göndermek için WebPush istemcisini kullanan bir örneği aşağıda bulun.
procedure SendWebPushNotification;
var
oSubscription: TsgcHTTP_API_WebPush_PushSubscription;
oWebPush: TsgcWebPush_Client ;
begin
oSubscription := TsgcHTTP_API_WebPush_PushSubscription.Create;
try
oSubscription.Endpoint := 'endpoint';
oSubscription.PublicKey := 'public key';
oSubscription.AuthSecret := 'authentication secret';
oWebPush := TsgcHTTP_API_WebPush_Client.Create(nil);
try
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!!!"}');
finally
oWebPush.Free;
end;
finally
oSubscription.Free;
end;
end;