Vaultrice React SDK - v0.9.5
    Preparing search index...

    Function useMessaging

    • React hook for managing real-time messaging and presence using NonLocalStorage.

      Handles connection state, message sending, joining/leaving presence, and error reporting. Automatically subscribes to presence and message events, and updates the connected users list.

      Parameters

      • id: string

        The unique identifier for the NonLocalStorage instance.

      • onMessage: (msg: JSONObj) => void

        Callback invoked when a message is received.

      • options: UseGeneralOptions

        General options including credentials and instance options.

      Returns any[]

      A tuple containing:

      • connected: Array of currently connected users.
      • send: Function to send a message.
      • join: Function to join presence with a user object.
      • leave: Function to leave presence.
      • error: Any error encountered during messaging or presence operations.