Overview

Updated

Introduces offline push notification services.

Chat supports integration of Google Firebase Cloud Messaging (FCM), which enables developers to use an offline push notification service. The service features low latency, high delivery, high concurrency, and no violation of the users' personal data.

Chat supports integration of offline push services that feature low latency, high delivery, high concurrency, and no violation of the users' personal data. The Web SDK itself does not support offline push; instead it supports offline push configuration on mobile platforms.

When a user goes offline because of client disconnection or the app process closing, Chat will push notifications to the offline user's device through the FCM message push service.

When a user goes offline because of client disconnection or the app process closing, Chat will push notifications to the offline user's device.

When the user is online again, the server will send the messages received while they were offline.

For example, when you are offline and another user sends you a message, a notification will pop up on your phone. When you open the app and log in successfully, Chat will actively pull the messages sent when you were offline.

If the app is running in the background and the user is still online, Chat will not push notifications. When multiple devices are logged in, you can configure the push certificate page in the Agora Console to send push notifications when either all or some of them are offline. This configuration is effective for all push channels.

When the app is running in the background or the phone is locked and the client has not disconnected from the Agora server, Chat will not receive offline push notifications. When multiple devices are logged in, if a device is forced offline, the notifications will not be received even if offline push is configured.

To use third-party offline push, configure the push certificate information in Agora Console. For example, for FCM push configure the FCM push certificate information, such as Private Key and Certificate Name. Then call updatePushConfig provided by the client SDK to upload the device token to the Agora server.

const  params  = {
     deviceId: WebIM.conn.clientResource, // Device ID, used to identify the device.
     deviceToken: 'deviceToken', // Push token to identify each app on each device.
     notifierName: 'PUSH_CERT_NAME', // Certificate name for push service.
};

WebIM.conn.uploadPushToken(params);

Understand the tech

The following figure shows the basic workflow of offline push:

  1. User B initializes the FCM push SDK and checks whether FCM push is configured.
  2. User B obtains the device token from the FCM push server according to the configured FCM push SDK.
  3. The FCM push server returns the device token to user B.
  4. User B uploads the push certificate name and device token to the Agora Chat server.
  5. User A sends a message to User B.
  6. The Agora Chat server checks whether user B is online. If so, the server directly sends the message to user B.
  7. If user B is offline, the Agora server determines whether the user has configured FCM push.
  8. The Agora server sends the message to the FCM push server.
  9. The FCM push server sends the message to user B.

Chat SDK provides the following features:

  • Set up push notifications for the app;
  • Get push notifications from apps;
  • Set up push notifications for your conversation;
  • Get push notifications for conversations;
  • Clear push notifications for a conversation;
  • Configure push translation;
  • Configure a push template;
  • Configure force push;
  • Configure a silent message.