Push notifications
ChatProvider runs push for the signed-in session on its own: it reads /push/config, asks for permission, registers the FCM token (re-registers on refresh), shows foreground notifications, clears notifications when a conversation is opened, and routes taps (conversation → room, thread → room + thread, ringing call → incoming-call UI) from foreground, background and killed states. logoutChatSession() deletes the tokens server-side.
Host steps
- Firebase + APNs — Firebase, APNs & backend setup and the native files in Native configuration.
index.js—configurePushNotifications(...)and the background handlers (App entry).- Your own listeners skip RealtimeX pushes and forward the launch notification:
import {extractPushData, isRealtimexPush, openRealtimexNotification} from '@realtimexsco/live-chat-react-native'; // onMessage / onNotificationOpenedAppif (isRealtimexPush(extractPushData(remoteMessage))) return; // cold startmessaging().getInitialNotification().then(message => { if (message && isRealtimexPush(extractPushData(message))) { openRealtimexNotification(extractPushData(message)); }});- Chat inside a tab — bring the tab forward in
onNotificationOpened; the package opens the room once the chat stack is mounted.
configurePushNotifications options
Settings UI
NotificationSettingsScreen (header bell) — master switch; direct / groups / threads / calls; preview; quiet hours; admin-locked rows. Per-conversation level and mute are in the room menu (roomOptions.notifications). Muted and mentions-only conversations show an icon in the list.
Other exports: registerPushForSession, unregisterPushForSession, startRealtimexNotifications, startRealtimexVoip (iOS — configurePushNotifications already calls it), subscribeNotificationPrefs, handleRealtimexForegroundMessage, NotificationsApiError, apiGetPushConfig, apiGetNotificationPreferences, apiPatchNotificationPreferences, apiGetConversationNotifications, apiPutConversationNotifications.
How push behaves in each app state
Only RealtimeX pushes are handled (data with userId and a RealtimeX category, or action: clear with a tag). Other pushes pass through to your app untouched. A push for a different signed-in user is dropped.
Android full-screen incoming calls
With @notifee/react-native installed and androidFullScreenCalls: true:
- A ringing call arrives data-only and the package draws a full-screen notification on the
rtx_callschannel with Accept / Decline. - It rings and vibrates until Accept, Decline, a
clear/ missed push, or the 40-second ring ends. - Accept opens the app, asks for the microphone (and camera for video) and joins. Decline rejects without opening the app, even when it was killed.
- The notification is drawn natively by the autolinked
RtxCallPushReceiverthe moment FCM delivers the push, so it shows even before JavaScript starts. - Both
setBackgroundMessageHandlerandnotifee.onBackgroundEventmust be registered inindex.js, or killed-app rings and Decline won't run. - Samsung and other OEM battery managers can block FCM: when testing, keep the app out of "Sleeping apps" and set battery usage to "Unrestricted". "Force stop" blocks FCM until the app is opened again.
iOS calls over PushKit + CallKit
When the client admin uploads an Apple VoIP key (/push/config returns voipConfigured: true):
- Install
react-native-voip-push-notificationandreact-native-callkeep, thenpod install. - Add the Push Notifications capability and the
voip+remote-notificationbackground modes. - That's all on the native side: the autolinked
RealtimexVoip(ios/RealTimeXChat/RealtimexVoip.m) sets up CallKit and PushKit at launch and reports every VoIP push to CallKit. configurePushNotifications(...)inindex.jsattaches the CallKit listeners, so a call that relaunched the app is answered or declined beforeChatProvidermounts.
The package ends the ringing CallKit call when the session doesn't match, the push expired, the call is no longer ringing, the caller cancels, the call is answered on another device, or a clear / missed push arrives. In the foreground the in-app overlay rings instead of CallKit.