sgcWebSockets · Technical Document

Firebase Cloud Messaging

Firebase Cloud Messaging HTTP v1 client — send Android, iOS and web push from Delphi using OAuth 2.0 service-account credentials.

Overview

Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably send messages at no cost.

At a glance

Component class
TsgcHTTPGoogleCloud_FCM_Client
Standards / spec
Firebase Cloud Messaging
Transports
TCP, TLS
Platforms
Windows, macOS, Linux, iOS, Android
Frameworks
VCL, FireMonkey, Lazarus / FPC
Edition
Standard / Professional / Enterprise

Features

Technical specification

Standards & specsFirebase Cloud Messaging · FCM HTTP v1 API reference
Component classTsgcHTTPGoogleCloud_FCM_Client (unit sgcHTTP_GoogleCloud_FCM_Client)
FrameworksVCL, FireMonkey, Lazarus / FPC
PlatformsWindows, macOS, Linux, iOS, Android

Main properties

The principal published / public properties used to configure and drive the component. Consult the online help for the full list.

TLSOptionsPublished or public property used to configure or query the component.
OnAuthTokenPublished or public property used to configure or query the component.
OnAuthTokenErrorPublished or public property used to configure or query the component.
GoogleCloudOptionsPublished or public property used to configure or query the component.
LogFilePublished or public property used to configure or query the component.
VersionPublished or public property used to configure or query the component.

Main methods

The principal public methods exposed by the component.

LoadSettingsFromFile()Public procedure exposed by the component.
RefreshToken()Public function exposed by the component.
Clear()Public procedure exposed by the component.

Quick Start

Drop the component on a form, configure the properties below and activate it. The snippet that follows shows the typical Authorization configuration sourced from the online help.

About this scenario. Google FCM component client can login to Google Servers using the following methods:

Delphi (VCL / FireMonkey)

oFCM := TsgcHTTPGoogleCloud_FCM_Client.Create(nil);
oFCM.TLSOptions.IOHandler := iohOpenSSL;
oFCM.TLSOptions.Version := tls1_3;
oFCM.TLSOptions.VerifyCertificate := True;
oFCM.TLSOptions.OpenSSL_Options.LibPath := oslpDefaultFolder;

C++ Builder

TsgcHTTPGoogleCloud_FCM_Client *oFCM = new TsgcHTTPGoogleCloud_FCM_Client(NULL);
oFCM->TLSOptions->IOHandler = iohOpenSSL;
oFCM->TLSOptions->Version = tls1_3;
oFCM->TLSOptions->VerifyCertificate = true;
oFCM->TLSOptions->OpenSSL_Options->LibPath = oslpDefaultFolder;

.NET (C#)

oFCM = new TsgcHTTPGoogleCloud_FCM_Client();
oFCM.TLSOptions.IOHandler = TwsTLSIOHandler.iohOpenSSL;
oFCM.TLSOptions.Version = TwsTLSVersions.tls1_3;
oFCM.TLSOptions.VerifyCertificate = true;
oFCM.TLSOptions.OpenSSL_Options.LibPath = oslpDefaultFolder;

Common scenarios

The following scenarios are lifted verbatim from the online help. Each shows the configuration and method calls needed to drive the component through a specific real-world flow.

1 · Google FCM Client

Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably send messages at no cost.

Delphi (VCL / FireMonkey)
oFCM:= TsgcHTTPGoogleCloud_FCM_Client.Create(nil);
oFCM.GoogleCloudOptions.Authorization := gcaOAuth2;
oFCM.GoogleCloudOptions.OAuth2.ClientId := '... your google client id...';
oFCM.GoogleCloudOptions.OAuth2.ClientSecret := '... your google client secret...';
C++ Builder
oFCM = new TsgcHTTPGoogleCloud_FCM_Client();
oFCM->GoogleCloudOptions->Authorization = gcaOAuth2;
oFCM->GoogleCloudOptions->OAuth2->ClientId = "... your google client id...";
oFCM->GoogleCloudOptions->OAuth2->ClientSecret = "... your google client secret...";
.NET (C#)
oFCM = new TsgcHTTPGoogleCloud_FCM_Client();
oFCM.GoogleCloudOptions.Authorization = gcaOAuth2;
oFCM.GoogleCloudOptions.OAuth2.ClientId = "... your google client id...";
oFCM.GoogleCloudOptions.OAuth2.ClientSecret = "... your google client secret...";

Sources used to build this document

Every external claim links back to a primary source. The online-help references decode the canonical deep-link the company maintains for this component.

Document scope. This document covers the publicly-documented surface of the Firebase Cloud Messaging component shipped with sgcWebSockets. For full property, method and event reference consult the online help linked above.