TMS FNC Core installed and the runtime package added to the project.
TMS FNC Push Notifications package referenced in the project.
Add and configure the server
Drop TTMSFNCWebPushServer onto a form or data module.
Set DefaultHTTPPort (default 80) or DefaultHTTPSPort (default 443) to the port your server should listen on.
Assign a TTMSFNCWebPushDB instance to PushDB so the server can persist incoming subscriptions.
Populate VAPIDSettings with the VAPID key pair generated for your application.
Add and configure the serverPascalC++
{ Inside your form's OnCreate event: }
WebPushServer1.DefaultHTTPPort := 8080;
WebPushServer1.PushDB := WebPushDB1;
{ Set VAPID keys via VAPIDSettings before activating }
WebPushServer1.Active := True;
// Inside your form's OnCreate event:
WebPushServer1->DefaultHTTPPort = 8080;
WebPushServer1->PushDB = WebPushDB1;
// Set VAPID keys via VapidSettings before activating
WebPushServer1->Active = true;
React to subscription events
React to subscription eventsPascalC++
procedure TForm1.WebPushServer1OnRegisterSubscription(
Sender: TObject; ASubscription: TTMSFNCWebPushSubscription);
begin
{ A browser has registered — the subscription is already stored in PushDB }
end;
void __fastcall TForm1::WebPushServer1OnRegisterSubscription(TObject *Sender,
System::Json::TJSONObject *AData, bool &AHandled)
{
// A browser has registered - inspect AData; set AHandled to take over the storage
}