Skip to content

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).

new ChatPushClient(options): ChatPushClient

Defined in: push/push-client.ts:28

ChatPushClientOptions

ChatPushClient

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.

boolean


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.

Promise<PushRegistrationResult>


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.

Promise<PushRegistrationResult>