TsgcWSAPIServer_WebPush › Events › OnWebPushSendNotificationException
Se activa cuando se produce una excepción al publicar una notificación en el servicio push (causas habituales: 400 Bad Request, 404/410 Gone por endpoints expirados, fallos TLS o de red).
property OnWebPushSendNotificationException: TsgcWSWebPushSendNotificationException;
// TsgcWSWebPushSendNotificationException = procedure(Sender: TObject; aSubscription: TsgcHTTP_API_WebPush_PushSubscription; E: Exception; var Remove: Boolean) of object
—
Se genera tanto desde SendNotification como desde el bucle por suscriptor dentro de BroadcastNotification. El parámetro var Remove tiene el valor predeterminado True: dejarlo así elimina la suscripción problemática de la lista interna (el comportamiento correcto para fallos permanentes como HTTP 410 Gone). Establézcalo en False para conservar la suscripción y reintentarla más tarde, por ejemplo cuando el fallo es transitorio (tiempo de espera de red, 5xx del servicio push). Use E para registro y diagnósticos.
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;