TsgcWSAPIServer_WebPush › 이벤트 › OnWebPushSendNotificationException
푸시 서비스에 알림을 POST하는 동안 예외가 발생할 때 발생합니다(일반적인 원인: 400 Bad Request, 만료된 엔드포인트에 대한 404/410 Gone, TLS 또는 네트워크 장애).
property OnWebPushSendNotificationException: TsgcWSWebPushSendNotificationException;
// TsgcWSWebPushSendNotificationException = procedure(Sender: TObject; aSubscription: TsgcHTTP_API_WebPush_PushSubscription; E: Exception; var Remove: Boolean) of object
—
SendNotification과 BroadcastNotification 내부의 구독자별 루프 모두에서 발생합니다. Remove var 매개변수의 기본값은 True입니다: 그대로 두면 문제가 있는 구독을 내부 목록에서 삭제합니다(HTTP 410 Gone과 같은 영구적 실패에 대한 올바른 동작). 실패가 일시적인 경우(네트워크 시간 초과, 푸시 서비스의 5xx) 구독을 유지하고 나중에 재시도하려면 False로 설정하십시오. 로깅 및 진단에는 E를 사용하십시오.
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;