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
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:
- The worker at /firebase-messaging-sw.js.
postinstallcopies it intopublic/(orstatic/) - 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.shellcp node_modules/@realtimexsco/live-chat/dist/firebase-messaging-sw.js public/ - HTTPS (
localhostis fine in development). - 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.
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.
Custom UI
import { usePushNotifications, NotificationSettings, apiUpdateConversationNotifications, mutedUntilFor, isMutedNow,} from "@realtimexsco/live-chat"; // Mute a chat for 8 hours ("1h" | "8h" | "24h" | "forever"; null unmutes)await apiUpdateConversationNotifications(conversationId, { mutedUntil: mutedUntilFor("8h"),}); // Is it still muted? (timed mutes end without an event)isMutedNow(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.