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 Apple Push Notification service (APNs), which enables iOS 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.

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 APNs message push service.

To use APNs offline push, configure the push certificate information in Agora Console and call bindDeviceToken provided by the client SDK to upload the device token to the Agora server.

To test the offline push function, download our demo.

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.

  10. User B registers with the APNs push service and obtains a push token.

  11. APNs returns a push token.

  12. User B uploads the push certificate name and push token to the Agora Chat server.

  13. User A sends a message to User B.

  14. The Agora Chat server checks whether user B is online. If so, the server directly sends the message to user B.

  15. If user B is offline, the Agora Chat server determines whether the user has APNs configured.

  16. The Agora server sends the message to the APNs push server.

  17. The APNs push server sends the message to user B.

The device token is the push token provided by APNs push. That is, the push token generated by the APNs SDK for the client app instance when your application is first launched. This token is used to identify every app on every device. APNs uses this token to clarify which device the message is sent to, and then forwards the message to the device. The device then notifies the app. You can call the registerForRemoteNotifications method to obtain the token. In addition, if you do not unbind the device token when logging out (pass NO to the aIsUnbindDeviceToken parameter when calling logout), the user will still receive offline push notifications during the validity period of the push certificate and the token.