Core SDK
Notifications
Web push, user channel events, and in-app alerts.
Push and in-app notifications use Worker-configured VAPID keys and the user-channel WebSocket.
Web push
import { useWebPush } from "@fluxy-chat/react";
import type { FluxyChatClient } from "@fluxy-chat/sdk";
function PushSettings({ client }: { client: FluxyChatClient }) {
const { permission, requestPermissionAndSubscribe, unsubscribe } = useWebPush(client);
if (permission === "unsupported") return null;
return (
<button onClick={() => requestPermissionAndSubscribe()}>
{permission === "granted" ? "Push enabled" : "Enable push"}
</button>
);
}Configure VAPID keys in Worker secrets / .dev.vars:
VAPID_PUBLIC_KEY=...
VAPID_PRIVATE_KEY=...See Web push (VAPID).
User channel
useNotifications and useUserChannel subscribe to per-user realtime events (inbox refresh, mentions, system alerts):
import { useNotifications } from "@fluxy-chat/react";
useNotifications({ client, onEvent: (event) => console.log(event) });Delivery types
| Channel | Mechanism |
|---|---|
| In-app | User channel WS + inbox |
| Web push | Browser Push API + Worker delivery |
| Email / SMS | Worker integrations (tenant-configured) |
Member JWT required for subscription registration.
Collab inbox kinds
useInbox items now include thread, comment, and custom besides mention/unread/follow_up/snooze. Map server_event comment fan-out with commentEventToInboxItem. UI: <InboxNotification /> from @fluxy-chat/ui. See Comments & threads.
Daily email digest (collab + chat)
Cron runDailyDigest (enable DAILY_DIGEST_ENABLED=true) emails yesterday's chat highlights and thread comments. Preferences:
GET /digest/preferences
PATCH /digest/preferences { enabled, email, emailEnabled, webPushEnabled, inAppEnabled }SDK: client.getDigestPreferences() / client.updateDigestPreferences({ enabled: true, email }). Delivery: Cloudflare Email binding or RESEND_API_KEY. From: DIGEST_EMAIL_FROM / EMAIL_FROM. Comments-only days still send (no chat messages required).