TsgcWSAPIServer_WebPush › Olaylar › OnWebPushUnsubscription
Bir tarayıcı, Unsubscription uç noktasına POST yaptığında (PushManager.unsubscribe() veya service-worker değişikliği) tetiklenir; aboneliği kalıcı deponuzdan kaldırmak için kullanın.
property OnWebPushUnsubscription: TsgcWSWebPushUnsubscription;
// TsgcWSWebPushUnsubscription = procedure(Sender: TObject; aSubscription: TsgcHTTP_API_WebPush_PushSubscription; var ResponseCode: Integer) of object
—
Dahili Subscriptions listesi, Subscriptions.RemoveSubscription aracılığıyla otomatik olarak güncellenir, böylece BroadcastNotification artık aboneliği kaldırılmış uç noktayı hedeflemez. Eski kayıtların tutulmaması için silme işlemini kendi deponuzda da yansıtın. ResponseCode değerini tarayıcıya geri gönderilen HTTP durumuna ayarlayın — normalde başarıda 200.
procedure TForm1.sgcWSAPIServer_WebPush1WebPushUnsubscription(Sender: TObject;
aSubscription: TsgcHTTP_API_WebPush_PushSubscription; var ResponseCode: Integer);
begin
DeleteSubscriptionFromDB(aSubscription.Endpoint);
ResponseCode := 200;
end;