WebPush Server
Send WebPush notifications from a Delphi server. Built-in VAPID signing, AES128GCM payload encryption and the subscription-management endpoints required by the spec.
Send WebPush notifications from a Delphi server. Built-in VAPID signing, AES128GCM payload encryption and the subscription-management endpoints required by the spec.
WebPush relying-party component — register subscriptions, encrypt payloads (RFC 8291), sign requests with VAPID (RFC 8292), POST to the user's push endpoint.
TsgcWSAPIServer_WebPush
Windows, macOS, Linux, iOS, Android
Enterprise
Configure the VAPID key pair, attach the embedded TsgcWebPush_Client (or use it directly), then call SendNotification with the subscription endpoint and payload.
uses
sgcWebSocket, sgcWebSocket_Server_APIs;
var
Server: TsgcWebSocketHTTPServer;
WebPush: TsgcWSAPIServer_WebPush;
begin
Server := TsgcWebSocketHTTPServer.Create(nil);
Server.Port := 8443;
Server.SSL := True;
WebPush := TsgcWSAPIServer_WebPush.Create(nil);
WebPush.Server := Server;
WebPush.VAPID.Subject := 'mailto:admin@example.com';
WebPush.VAPID.PrivateKey.LoadFromFile('vapid-priv.pem');
WebPush.VAPID.PublicKey.LoadFromFile ('vapid-pub.pem');
Server.Active := True;
// later, when you have a subscription record
WebPush.SendNotification(
'https://fcm.googleapis.com/wp/...', // endpoint
'p256dh-public-key', // from PushSubscription.getKey(p256dh)
'auth-secret', // from PushSubscription.getKey(auth)
'{"title":"Hello","body":"Notification body"}');
end;
A complete WebPush relay — manages subscriptions and sends VAPID-signed AES128GCM-encrypted notifications.
Hosts the POST /webpush/subscribe + DELETE /webpush/unsubscribe contract on the embedded HTTP server, so browser clients can register their PushSubscription with you.
Per RFC 8292 the component signs each push with an ES256 JWT and includes the VAPID public key in the Crypto-Key header. Subject contact (mailto:) is configurable.
Implements RFC 8291 message-encryption: derives the shared secret with ECDH against the user's p256dh, computes HKDF-derived keys, encrypts with AES128GCM.
Pads payloads up to the recommended max so message length cannot be inferred from the ciphertext — matches what browser push services expect.
TsgcWebPush_Client is a sibling that just sends notifications without hosting subscriptions — useful if your subscriptions live in a separate service.
Standard TTL, Urgency and Topic headers are exposed as method parameters, letting you tell the push service how long to retain undelivered notifications.
Authoritative sources for the protocol this component implements.
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.
| Online Help — WebPush Full property, method and event reference for this component. | Open | |
| Demo Project — Demos\20.HTTP_Protocol\11.WebPush_Notifications Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below. | Open | |
| Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only. | Open | |
| User Manual (PDF) Comprehensive manual covering every component in the library. | Open |