Sanity Library Reference Docs
    Preparing search index...

    Function reportPresence

    • Beta

      Announces where the current user is, so other clients in the same project and dataset can show them. Reading presence never announces anything, so this is the only way an app becomes visible to others.

      Call it again whenever the user moves. Announcements are collapsed over a short window and then repeated every 30 seconds while idle, which is what tells peers the session is still alive.

      Which specific document each location resolves to depends on its perspective, and that matters for interoperability: other clients, the Studio included, compare exact document ids for field-level presence. Pass the perspective you are editing under rather than building a draft or version id yourself.

      Parameters

      • instance: SanityInstance

        the Sanity instance

      • params: { locations: ReportPresenceOptions[]; resource?: DocumentResource }

        the resource to announce on, plus the locations to report. Pass one location with a documentId for document-level presence, add a path for field-level presence, and pass an empty array to appear present without being in any document.

      Returns void