Hiyve Components - v1.0.0
    Preparing search index...

    Function useUserChatStream

    • Subscribe to the current user's GLOBAL chat stream — new messages across ALL of their conversations — for notification badges and toasts. handlers.onMessage fires for each arrival (each carries roomName); the stream excludes the user's own messages and reconnects automatically.

      Unlike useUserChat (which streams one active conversation), this opens a single always-on stream regardless of which conversation, if any, is open — so it works while the user is anywhere in the app. No-op when userId is falsy or no cloud client is configured.

      Handlers are read through a ref, so passing new closures each render does NOT reconnect the stream; only a change of userId does.

      Parameters

      • userId: string | null | undefined

        The authenticated user (their own conversations only)

      • handlers: {
            onError?: (error: Error) => void;
            onMessage?: (message: ChatStreamMessage) => void;
        }

        onMessage / onError callbacks

      Returns void