TsgcWSAPIServer_WebPushEvents › OnWebPushSubscription

OnWebPushSubscription Event

Fires when a browser POSTs to the Subscription endpoint after calling PushManager.subscribe(); receive the endpoint, p256dh key and auth secret to persist server-side.

Syntax

public event TsgcWSWebPushSubscriptionHandler OnWebPushSubscription;
// delegate void TsgcWSWebPushSubscriptionHandler(TObject Sender, TsgcHTTP_API_WebPush_PushSubscription aSubscription, out int ResponseCode)

Default Value

Remarks

The component already stores the new subscription in the internal Subscriptions list so it becomes reachable by BroadcastNotification. Use the event to persist the incoming subscription to your own database and/or apply server-side validation (authentication, rate limiting, duplicate detection). Set ResponseCode to the HTTP status returned to the browser — return 200/201 on success or a 4xx to reject (for instance 401 if the user is not authorised).

Example

Back to Events