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

    Class CloudClient

    Index

    Constructors

    Methods

    • Parameters

      • meetingId: string

      Returns Promise<void>

    • Check which connected users match a metadata-based relationship with the caller.

      The server derives the match value from the caller's profile in the database — the client only specifies which metadata field names to compare and their own profile ID.

      Parameters

      • callerProfileId: string

        The calling user's profile ID (for metadata lookup)

      • match: { callerField: string; userField: string }

        Field name mapping: userField on connected users, callerField on the caller

      Returns Promise<string[]>

      Array of online user IDs that match

    • Clear cached token (forces re-generation on next request)

      Returns void

    • Clear the current userId (e.g., on logout). Stops the presence heartbeat and sends an offline signal.

      Returns void

    • Open an SSE stream for real-time active room discovery. Returns a handle with a close() method to terminate the connection.

      Parameters

      • userId: string

        The user ID to filter rooms for (required)

      • Optionalhandlers: {
            onError?: (error: Error) => void;
            onRoomAdded?: (room: CloudActiveRoom) => void;
            onRoomRemoved?: (roomName: string) => void;
            onRoomUpdated?: (room: Partial<CloudActiveRoom> & { name: string }) => void;
            onSnapshot?: (rooms: CloudActiveRoom[]) => void;
        }

        Event handlers for stream events

      Returns Promise<ActiveRoomsStreamHandle>

    • Open an SSE stream for real-time chat messages in a room. Returns a handle with a close() method to terminate the connection.

      Parameters

      • roomName: string

        The room to stream messages for

      • Optionalhandlers: {
            onError?: (error: Error) => void;
            onMessage?: (message: ChatStreamMessage) => void;
            onSnapshot?: (messages: ChatStreamMessage[]) => void;
        }

        Event handlers for stream events

      Returns Promise<ChatStreamHandle>

    • Open an SSE stream of new chat messages across ALL of a user's conversations — for global unread badges / notifications. Each message carries its roomName. There is no snapshot; derive initial unread from getConversations. Returns a handle with close().

      Mirrors connectChatStream's ticketed-reconnect strategy: a dropped connection mints a FRESH ticket (the old one is single-use) with backoff.

      Parameters

      • userId: string

        The authenticated user

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

        Event handlers for stream events

        • OptionalonError?: (error: Error) => void
        • OptionalonMessage?: (message: ChatStreamMessage) => void
        • OptionalonReconnect?: () => void

          The stream came back after a drop — fired once the server confirms the re-opened stream with its ready event, on RE-connects only, never on the first connect. A re-open that is severed before ready does not count, so a network that keeps admitting and dropping the request does not trigger a refetch per attempt.

          Act on it: unlike the per-room chat stream, this one replays NOTHING on connect — the server sends a ready event carrying a room count and no messages — so anything sent while the stream was down is simply never delivered here. Without a refetch in response to this, a user on a network that severs long-lived connections silently loses the unread badge and the new-message toast for those messages (2026-09-09).

      Returns Promise<ChatStreamHandle>

    • Open an SSE stream for real-time user-file updates. Returns a handle with a close() method to terminate the connection.

      Parameters

      • userId: string

        The user ID whose visible files to stream (required)

      • Optionalhandlers: {
            onError?: (error: Error) => void;
            onFileAdded?: (file: CloudUserFile) => void;
            onFileRemoved?: (info: { docId?: string; fileId?: string }) => void;
            onFileUpdated?: (file: CloudUserFile) => void;
            onResync?: (info: { reason?: string }) => void;
            onSnapshot?: (files: CloudUserFile[]) => void;
        }

        Event handlers for stream events

      Returns Promise<UserFilesStreamHandle>

      Events emitted (in order of typical occurrence):

      • snapshot initial visible-files list
      • file-added a file was created or shared with this user
      • file-updated a file visible to this user changed
      • file-removed a file visible to this user was deleted or unshared
      • resync server lost continuity; consumer should refetch via REST
    • Open an SSE stream of the user's notifications/announcements. Emits a snapshot on connect, then added/updated/removed deltas (and resync when the server lost continuity). Mirrors connectUserChatStream's ticketed reconnect: a dropped connection mints a FRESH single-use ticket with backoff.

      Parameters

      • userId: string
      • Optionalhandlers: {
            onError?: (error: Error) => void;
            onEvent?: (event: NotificationStreamEvent) => void;
        }

      Returns Promise<NotificationStreamHandle>

    • Delete one notification the caller SENT — removes it for every recipient (their inboxes live-update over the SSE stream) and from the Sent view. Sender-only: resolves false when the caller is not the sender.

      Parameters

      • id: string

      Returns Promise<boolean>

    • Tear down the client. Stops the presence heartbeat and sends an immediate offline signal. Call this when the client is no longer needed.

      Returns void

    • List active rooms for the authenticated org/tenant. When userId is provided, only rooms targeting that user are returned.

      Parameters

      • OptionaluserId: string

      Returns Promise<CloudActiveRoom[]>

    • Get the SSE stream URL for active room discovery. Returns the full URL including authentication and userId query parameters.

      Parameters

      • userId: string

        The user ID to filter rooms for (required)

      Returns Promise<string>

      EventSource (SSE) does not support custom headers, so authentication is passed via query parameter. Use the returned URL with store.connectActiveRooms(url) or new EventSource(url).

    • Get paginated message history for a room.

      Parameters

      • roomName: string

        The room to fetch history for

      • Optionaloptions: { cursor?: string; limit?: number }

        Pagination options (cursor, limit)

      Returns Promise<ChatHistoryResponse>

      Messages and next cursor for pagination

    • Get the SSE stream URL for real-time chat messages in a room. Exchanges the cloud token for a single-use ticket (keeps token out of URL).

      Parameters

      • roomName: string

        The room to stream messages for

      Returns Promise<string>

      Full SSE URL with ticket and roomName query params

    • Get all conversations (rooms) the user has chatted in, with last message preview and count.

      Parameters

      • userId: string

        The user ID to fetch conversations for

      Returns Promise<ChatConversation[]>

      Array of conversation summaries sorted by most recent

    • Parameters

      • options: {
            limit?: number;
            startAfter?: string | Date;
            startBefore?: string | Date;
            status?: string;
        } = {}

      Returns Promise<Meeting[]>

    • The caller's unread notification count (for a badge).

      Returns Promise<number>

    • Build the SSE URL for a user's GLOBAL chat stream (new messages across all of their conversations — for notification badges). Exchanges the cloud token for a single-use ticket so the token stays out of the URL.

      Parameters

      • userId: string

        The authenticated user (their own conversations only)

      Returns Promise<string>

      Full SSE URL with ticket and userId query params

    • Get the SSE stream URL for real-time user-file updates. Returns the full URL including a single-use ticket and userId query parameter.

      Parameters

      • userId: string

        The user ID whose visible files to stream (required)

      Returns Promise<string>

      EventSource (SSE) does not support custom headers, so authentication is passed via query parameter. Use the returned URL with store.connectUserFiles(url) or new EventSource(url).

    • Mint an SSE ticket and build the per-user notifications stream URL.

      Parameters

      • userId: string

      Returns Promise<string>

    • List notifications for the caller. box: 'inbox' (default) returns announcements addressed to them; box: 'sent' returns ones they sent.

      Parameters

      • limit: number = 50
      • box: "inbox" | "sent" = 'inbox'

      Returns Promise<CloudNotification[]>

    • Mark all the caller's notifications read. Returns how many changed.

      Returns Promise<number>

    • Mark one notification read.

      Parameters

      • id: string

      Returns Promise<boolean>

    • Send a presence heartbeat to indicate the current user is online. Normally driven automatically by the presence option (interval + activity listeners); the server expires the key after a short TTL, so beats must arrive comfortably within it.

      Parameters

      • userEmail: string

        The current user's email

      Returns Promise<void>

    • Immediately remove the user's online presence (e.g., on logout).

      Parameters

      • userEmail: string

        The current user's email

      Returns Promise<void>

    • Push mood/sentiment data to a response context.

      Parameters

      • responseId: string

        Context identifier (e.g. from a recording or live session)

      • userId: string

        User ID for request validation

      • sentimentContext: SentimentContext

        Sentiment/mood data to push

      Returns Promise<{ responseId: string }>

    • Query against accumulated meeting context identified by a response ID.

      Parameters

      • responseId: string

        Context identifier (e.g. from a recording or live session)

      • userId: string

        User ID for request validation

      • query: string

        Question to ask about the meeting content

      • Optionaloptions: { model?: string; promptKey?: string }

        Optional parameters (promptKey, model)

      Returns Promise<AIResponse>

    • Remove an advertised room from discovery.

      Parameters

      • roomName: string

      Returns Promise<void>

    • Send a chat message to a room. The message is persisted and broadcast to SSE subscribers via MongoDB change stream.

      Parameters

      • roomName: string

        The room to send the message to

      • message: string

        The message text (max 1000 chars)

      • userId: string

        The sender's user ID

      Returns Promise<{ messageId: string }>

      The persisted message ID

    • Update the cloud token (e.g., after manual refresh)

      Parameters

      • token: string

      Returns void

    • Set or update the current user's email. Forces a token refresh on the next request. Restarts the presence heartbeat if enabled.

      Parameters

      • userId: string

      Returns void