RealTimeX
Sign inStart for free
RealTimeXWeb Package
IntroductionPrerequisitesInstallationProject setupQuick start
Package structureConfigurationComponentsHooksAPI integrationSocket events
OverviewReplace entire UIReplace componentsStyle with classNamesThemes & localePhone & video callingIn-call control barFeatures
Unread badgeRich-text messagesPins, stars & datesMessage threadsMentionsCanvas & draftsNotificationsAdmin permissionsServer refusalsSession & token refresh
Host app integrationTroubleshootingFAQVersion historyBest practicesSupport & contact
Web packageBuilt-in features

Notifications

Push, desktop and per-chat mute. The server decides who is notified; the package registers the device, shows the notification and opens the right chat.

What is built in

FeatureWhere in the UI
Push on/off for this deviceAccount settings → PushNotificationToggle
Notification preferencesAccount settings → NotificationSettings (DMs, groups: all / mentions / nothing, threads, calls, message preview, quiet hours)
Per-chat level and muteHeader options menu → Notifications (Default / All / Mentions only / Off; mute 1 h / 8 h / 24 h / forever)
Muted icon in the chat listShown on muted conversations
Thread muteBell in the thread header
In-app bannerForegroundPushBridge (auto-mounted) - not for calls or the chat you're viewing
Click → open chat / threadAutomatic

Options the workspace admin locked are shown but disabled with “Set by your workspace admin”.

Account settings order

On the web, Push notificationscomes first - it registers this browser. Until it's on, the Notificationssection below is greyed out with “Turn on Push notifications above to choose what you're notified about.” The section stays usable where that switch is hidden or can't be turned on (desktop apps, browsers without push, workspaces without push). Choices are saved per user, so they still apply to in-app banners and the user's other devices.

The push row is also greyed out when the workspace turned off this device's channel (web, or desktop in Electron), and it updates live when the admin changes it.

Web push setup (FCM)

Push goes through your workspace's own Firebase project: the client admin connects it on the RealtimeX dashboard once, and every app that signs in with that clientId uses it. No Firebase keys go in your frontend - the package reads the web config and Web Push key from the backend (GET /notifications/push/config). Until a project is connected, pushes go through RealtimeX's shared project.

In your app you only need:

  1. The worker at /firebase-messaging-sw.js. postinstall copies it into public/ (or static/) - check after every upgrade, or copy it yourself. The package registers it under its own /rtx-push/scope, so it never clashes with your site's Firebase worker. It must be served from the domain root.
    shell
    cp node_modules/@realtimexsco/live-chat/dist/firebase-messaging-sw.js public/
  2. HTTPS (localhost is fine in development).
  3. User opt-in. Push is per browser: the user turns on Account settings → Push notifications (or call usePushNotifications().enable() from your own UI). After that, every sign-in re-registers and sign-out unregisters.
SituationWebDesktop (Electron)
Chat open (foreground)In-app banner onlyIn-app banner only
Tab hidden or closed (background)OS notification from the worker—
Window unfocused / minimised—Native notification
Incoming callAlways notifiesAlways notifies

Desktop (Electron)

Electron has no browser push. Expose a window.desktop bridge from your preload script and the package switches to desktop mode:

  • the socket connects with platform: "desktop", so the workspace's desktop channel (not web) turns it on or off;
  • browser push and its settings switch are turned off;
  • notifications arrive over the socket - native while the window is unfocused, the in-app banner while it's focused.
MemberRequiredUsed for
showNotification({ id, title, body, data })YesNative notification while unfocused
onNotificationClick(handler)YesClick → the package opens threadRootId or conversationId. Returns an unsubscribe
closeNotifications(tag)RecommendedClose a chat's notifications once it's read
setBadgeCount(count)OptionalNot called by the package - set it from the unread total

Note

In desktop mode PushNotificationToggle renders nothing; use NotificationSettings.

Custom UI

tsx
1import {2  usePushNotifications,3  NotificationSettings,4  apiUpdateConversationNotifications,5  mutedUntilFor,6  isMutedNow,7} from "@realtimexsco/live-chat";8 9// Mute a chat for 8 hours ("1h" | "8h" | "24h" | "forever"; null unmutes)10await apiUpdateConversationNotifications(conversationId, {11  mutedUntil: mutedUntilFor("8h"),12});13 14// Is it still muted? (timed mutes end without an event)15isMutedNow(channel.notifications);

Listen to notification socket events with onNotificationEvent and NOTIFICATION_EVENTS (notification, notification_clear, notification_prefs_updated, notification_policy_updated). Also exported: enablePushOnThisDevice, disablePushOnThisDevice, getDesktopBridge.

PreviousCanvas & draftsNextAdmin permissions

On this page

What is built inAccount settings orderWeb push setup (FCM)Desktop (Electron)Custom UI
Back to top