This demo is best experienced on a larger device.

Mobile Push Gateway Demo

Try real-time messaging to iOS and Android via FCM and APNs with PubNub’s Push Gateway, ensuring delivery even when apps are inactive. It intelligently routes messages through a global edge network, achieving sub-100ms latency, supporting millions of connections, and scaling elastically. Automatic token management and failover mechanisms enhance reliability. Implementation includes device registration, push service configuration, and message publishing via PubNub’s unified API

About this demo

PubNub Mobile Push Gateway  How It Works

PubNub’s real-time messaging system bridges native push notification services like FCM and APNs, managing message delivery according to the app's lifecycle state and push registration status. When a message is published, and the device is online while the app is in the foreground, the message is delivered directly. If the app is in the background, inactive, or the device is offline, PubNub forwards the message to the appropriate push notification service, ensuring reliable delivery.

In comparison to native FCM/APNs integrations, PubNub simplifies cross-platform delivery by managing intelligent failover and automatic retries. While FCM/APNs necessitate manual handling of device states, token expiration, and service disruptions, PubNub abstracts these complexities, guaranteeing reliable message routing even when one push service fails. By reducing the development burden, it enhances message delivery reliability and provides a seamless experience without requiring management of multiple services.

Features

  • Seamless Integration: Unified API for both FCM (Android) and APNs (iOS) push notifications.

  • Automatic Background Handling: Ensures message delivery even when apps are closed or in the background.

  • Low Latency: Global edge infrastructure ensures sub-100ms message delivery worldwide.

  • Scalability: Supports millions of simultaneous connections, handling high traffic volumes.

  • Reliable Message Routing: An intelligent failover mechanism ensures messages are retried and delivered. This ensures reliable message delivery by automatically switching between services like Apple Push Notification Service (APNs), Firebase Cloud Messaging (FCM), Microsoft Push Notification Service (MPNS), and Huawei Push Notification Service (HMS) if one service fails.

  • Device Token Management: Automatically maps PubNub channels to FCM/APNs tokens.

  • Token expiration: PubNub automatically refreshes expired tokens using a registered refresh token, ensuring uninterrupted access and secure communication without manual intervention.

Push Notification Workflow:

  1. Client Subscribes: The mobile app registers for push notifications and subscribes to a PubNub channel.

  2. Device Token Registration: The device’s unique push token (from FCM/APNs) is mapped to the PubNub channel.

  3. Message Publishing: When a message is published, PubNub checks the device status.

  4. Foreground Delivery: If the app is active, the message is delivered via PubNub’s real-time transport (WebSockets/MQTT/TCP).

  5. Background Delivery: If the app is inactive, the message is forwarded to FCM/APNs for push notification delivery.

Latency and Global Distribution

PubNub’s globally distributed network ensures low-latency message delivery with an average of sub-100ms end-to-end delivery time. Messages are routed through the closest edge node to minimize transmission delays and optimize push notification performance.

Scaling Up

  • Elastic Scaling: PubNub automatically scales to accommodate growing user bases.

  • High Throughput: Supports millions of push notifications per second.

  • Multi-Region Support: Ensures redundancy and failover across multiple global regions.