Vaultrice React SDK - v1.1.0
    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.

      • onMessageOrOptions: undefined | UseMessagingOptions | ((msg: JSONObj) => void)

        Either a callback for messages or options object.

      • Optionaloptions: UseMessagingOptions

        General options (only when second param is onMessage).

      Returns UseMessagingReturn

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

      • options: UseMessagingOptions

        General options (only when second param is onMessage).

      Returns UseMessagingReturn

      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.