Firebase Cloud Messaging (FCM)

Envoie des notifications push Firebase Cloud Messaging V1 depuis Delphi. Signature JWT par service-account, échange de tokens OAuth 2.0 et construction de messages FCM typés dans un seul composant.

TsgcHTTPGoogleCloud_FCM_Client

FCM HTTP V1 client — loads your Google service-account JSON, signs an RS256 JWT, exchanges it for an OAuth access token and POSTs the FCM message to fcm.googleapis.com/v1/projects/<id>/messages:send.

Classe du composant

TsgcHTTPGoogleCloud_FCM_Client

Plateformes

Windows, macOS, Linux, iOS, Android

Édition

Standard / Professional / Enterprise

Charge le service account, envoie le push

Load your Firebase service-account JSON, set the project id, then call SendMessage with the FCM payload (token / topic / condition).

uses
  sgcHTTP;

var
  FCM: TsgcHTTPGoogleCloud_FCM_Client;
begin
  FCM := TsgcHTTPGoogleCloud_FCM_Client.Create(nil);
  FCM.GoogleCloudOptions.ServiceAccountJSON.LoadFromFile('service-account.json');

  FCM.SendMessage(
    'fcm-device-token-here',
    'Hello from Delphi',
    'This is a test FCM push');
end;
// uses: sgcHTTP
TsgcHTTPGoogleCloud_FCM_Client *FCM = new TsgcHTTPGoogleCloud_FCM_Client(this);
FCM->GoogleCloudOptions->ServiceAccountJSON->LoadFromFile("service-account.json");

FCM->SendMessage(
  "fcm-device-token-here",
  "Hello from Delphi",
  "This is a test FCM push");

Ce qu’il y a à l’intérieur

Targets the FCM HTTP v1 endpoint — the legacy fcm.googleapis.com/fcm/send endpoint was deprecated by Google.

Service-account auth

Loads the standard Firebase service-account JSON, signs an RS256 JWT with the contained private key, then exchanges it at oauth2.googleapis.com/token for an access token.

Send to token / topic / condition

SendMessage overloads accept a registration token, a topic name (/topics/news) or a topic condition expression. SendBroadcast targets a topic for fan-out.

Notification + data payloads

Both the notification object (title/body/image) and the free-form data dictionary are exposed, including platform-specific overrides (Android android, iOS apns, Web webpush).

Token caching

Access tokens are cached and refreshed only when expired, so high-volume senders don't hammer the OAuth endpoint.

HTTP transport

Uses the project's standard HTTP client — pair with proxies, TLS settings and rate limiters as you would any other HTTP request.

Errors typed

OnSendError reports HTTP and FCM-specific errors (unregistered token, invalid argument, quota exceeded) so you can prune dead tokens or back off.

Spécifications et références

Sources de référence pour l'API implémentée par ce composant.

Documentation et démos

Lien direct vers la référence du composant, récupère le projet de démo prêt à exécuter et télécharge l’essai.

Aide en ligne — FCM Client Référence complète des propriétés, méthodes et événements de ce composant.
Projet de démo — Demos\20.HTTP_Protocol\03.Google Projet d’exemple prêt à exécuter. Livré dans le paquet sgcWebSockets — télécharge l’essai ci-dessous.
Document technique (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
Manuel utilisateur (PDF) Manuel exhaustif couvrant chaque composant de la bibliothèque.

Prêt à envoyer des push FCM depuis Delphi ?

Télécharge l'essai gratuit et intègre Firebase Cloud Messaging à tes applications Delphi.