Skip to main content
Table of Contents

Getting started with TMS FNC Web Push Sender

Prerequisites

  • TMS FNC Core installed and the runtime package added to the project.
  • TMS FNC Push Notifications package referenced in the project.
  • A populated TTMSFNCWebPushDB with at least one active subscription.

Add and configure the sender

  1. Drop TTMSFNCWebPushSender onto a form or data module.
  2. Assign a TTMSFNCWebPushDB instance to PushDB so the sender can read stored subscriptions.
  3. Populate VAPIDSettings with the same VAPID key pair used by the server.
Add and configure the senderPascalC++
{ Inside your form's OnCreate event: }
WebPushSender1.PushDB := WebPushDB1;
{ Set VAPID keys via VAPIDSettings before sending }
// Inside your form's OnCreate event:
WebPushSender1->PushDB = WebPushDB1;
// Set VAPID keys via VapidSettings before sending

Send a notification to all subscribers

Send a notification to all subscribersPascalC++
{ Broadcast a notification to every subscription in PushDB }
WebPushSender1.SendNotificationAll('Hello', 'A notification for every subscriber');
// Broadcast a notification to every subscription in PushDB
WebPushSender1->SendNotificationAll("Hello", "A notification for every subscriber");

React to delivery outcomes

React to delivery outcomesPascalC++
procedure TForm1.WebPushSender1OnNotificationSent(
  Sender: TObject; ASubscription: TTMSFNCWebPushSubscription);
begin
  { Notification was accepted by the push service }
end;

procedure TForm1.WebPushSender1OnNotificationError(
  Sender: TObject; ASubscription: TTMSFNCWebPushSubscription;
  AError: string);
begin
  { Delivery failed — inspect AError }
end;
void __fastcall TForm1::WebPushSender1OnNotificationSent(TObject *Sender,
  int AResponseCode, System::UnicodeString AResponse, System::UnicodeString AEndpoint,
  System::UnicodeString APayload, System::UnicodeString AUserID, System::UnicodeString ABrowserID)
{
  // Notification was accepted by the push service
}

void __fastcall TForm1::WebPushSender1OnNotificationError(TObject *Sender,
  int AResponseCode, System::UnicodeString AResponse, System::UnicodeString AEndpoint,
  System::UnicodeString APayload, System::UnicodeString AUserID, System::UnicodeString ABrowserID,
  bool &ADelete)
{
  // Delivery failed - inspect AResponseCode and AResponse
}

Next steps

  • Guides — notification payloads, VAPID authentication, error handling.
  • API reference — full class reference.