ChatPushClient
Defined in: push/push-client.ts:22
Web Push registration for a signed-in end user’s own browser — a separate concern from realtime (see ../core), with its own subscribe/ unsubscribe lifecycle rather than an always-on connection.
Zero runtime dependencies, same as the realtime entry points: this repo
owns its own VAPID keypair server-side and sends via the standard Web
Push Protocol directly (see docs/notifications.md) — there’s no
confirmed, documented way for the realtime provider to accept a
caller-supplied VAPID keypair for actual delivery, so this package never
depends on their SDK for push either. The browser only ever talks to: the
native serviceWorker/PushManager APIs, and this Chat API
(GET /notifications/vapid-public-key, POST/DELETE /tenants/:tenant_id/notifications/push/devices) — no vendor SDK import, no vendor client,
no direct communication with the realtime provider at all.
Mirrors apps/frontend/src/app/core/notifications/push-registration-channel.service.ts exactly — this package supersedes that file (see docs/notifications.md).
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ChatPushClient(
options):ChatPushClient
Defined in: push/push-client.ts:28
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”ChatPushClient
Methods
Section titled “Methods”isSupported()
Section titled “isSupported()”isSupported():
boolean
Defined in: push/push-client.ts:45
Whether this environment can support Web Push at all — check before showing an “enable notifications” affordance.
Returns
Section titled “Returns”boolean
register()
Section titled “register()”register():
Promise<PushRegistrationResult>
Defined in: push/push-client.ts:63
Registers the service worker (idempotent — safe to call every time), subscribes via the browser’s native Push API, and sends the resulting subscription to the Chat API. Must be called from inside a real user gesture (e.g. a button’s click handler) the first time — browsers silently withhold the permission prompt for a request that isn’t tied to one; see the README. Never rejects.
Returns
Section titled “Returns”Promise<PushRegistrationResult>
unregister()
Section titled “unregister()”unregister():
Promise<PushRegistrationResult>
Defined in: push/push-client.ts:86
Unsubscribes this browser and removes it from the Chat API. Works even if register() never ran this session. Never rejects.
Returns
Section titled “Returns”Promise<PushRegistrationResult>