Class FcmTransport

java.lang.Object
com.iizix.server.push.engine.transport.FcmTransport
All Implemented Interfaces:
IPushTransport

public final class FcmTransport extends Object implements IPushTransport
The Firebase Cloud Messaging transport, HTTP v1: POST https://fcm.googleapis.com/v1/projects/{project}/messages:send with an OAuth 2.0 bearer token minted from the application's service account.

The subscription is the registration token the Cordova client obtained from the FirebaseX plugin. Both Android and iOS devices are reached here: with the plugin in FCM mode the iOS token is an FCM registration token and FCM relays through APNs (ruling on the iOS transport, 2026-09-06). An PushTransport.APNS row, a raw APNs token registered by the legacy client branch, is not this transport's.

Message mapping: notification.title, body and image from the message; data from options.data, every value a string as FCM requires; android.ttl and apns-expiration from the TTL; android.priority and apns-priority from the urgency; android.notification.tag and icon from options.tag and options.icon.

Status mapping: 200 delivered; 404 with UNREGISTERED, or 400 whose error names the registration token, endpoint stale; 429, 500, 503 transient with Retry-After; 401 and 403 the credentials, permanent and the cached token dropped; other 4xx permanent.

Author:
Christopher Mindus
  • Constructor Details

    • FcmTransport

      public FcmTransport(HttpClient client, AppPushConfigs configs)
      Constructor.
      Parameters:
      client - The started Jetty client.
      configs - The application configurations.
  • Method Details

    • getKind

      public PushTransport getKind()
      Description copied from interface: IPushTransport
      Gets the transport kind.
      Specified by:
      getKind in interface IPushTransport
      Returns:
      The kind.
    • getState

      public TransportState getState(String appId)
      Description copied from interface: IPushTransport
      Gets whether this transport can send for an application.
      Specified by:
      getState in interface IPushTransport
      Parameters:
      appId - The application ID, * for iiziRun.
      Returns:
      The state, never null.
    • send

      public TransportResult send(SubscriptionRecord subscription, PushMessage message, long ttlMillis, DeliveryUrgency urgency)
      Description copied from interface: IPushTransport
      Sends a notification to one subscription. Blocks the calling (virtual) thread until the push service has answered or the request timed out.
      Specified by:
      send in interface IPushTransport
      Parameters:
      subscription - The subscription.
      message - The notification.
      ttlMillis - The effective time-to-live in milliseconds, already defaulted and clamped by the engine; converted to seconds at the header only.
      urgency - The effective urgency.
      Returns:
      The result, never null; a failure is an outcome, never an exception.
    • dispose

      public void dispose()
      Description copied from interface: IPushTransport
      Releases the transport's resources.
      Specified by:
      dispose in interface IPushTransport