TsgcWSAPIServer_WebPush › Olaylar › OnWebPushSendNotificationException
Bir bildirim push hizmetine POST edilirken bir istisna tetiklendiğinde tetiklenir (tipik nedenler: 400 Bad Request, süresi dolmuş uç noktalar için 404/410 Gone, TLS veya ağ hataları).
property OnWebPushSendNotificationException: TsgcWSWebPushSendNotificationException;
// TsgcWSWebPushSendNotificationException = procedure(Sender: TObject; aSubscription: TsgcHTTP_API_WebPush_PushSubscription; E: Exception; var Remove: Boolean) of object
—
Hem SendNotification'dan hem de BroadcastNotification içindeki abone başına döngüden tetiklenir. Remove var-parametresi varsayılan olarak True'dur: olduğu gibi bırakmak, sorunlu aboneliği dahili listeden düşürür (HTTP 410 Gone gibi kalıcı hatalar için doğru davranış). Aboneliği tutmak ve daha sonra yeniden denemek için False olarak ayarlayın, örneğin hata geçici olduğunda (ağ zaman aşımı, push servisinden 5xx). Günlüğe kaydetme ve tanılama için E kullanın.
procedure TForm1.sgcWSAPIServer_WebPush1WebPushSendNotificationException(
Sender: TObject; aSubscription: TsgcHTTP_API_WebPush_PushSubscription;
E: Exception; var Remove: Boolean);
begin
LogError(aSubscription.Endpoint, E.Message);
// keep subscription on transient errors, remove it on permanent ones
Remove := Pos('410', E.Message) > 0;
end;