Function getOrCreateDocAndToken

  • A convenience wrapper around DocumentManager.getOrCreateDocAndToken for getting or creating a document with the given ID and returning a client token for accessing it.

    Parameters

    • connectionString: string

      A connection string (starting with ys:// or yss://) referring to a y-sweet server.

    • Optional docId: string

      The ID of the document to get or create. If not provided, a new document with a random ID will be created.

    • Optional authDocRequest: AuthDocRequest

      An optional AuthDocRequest providing options for the token request.

    Returns Promise<ClientToken>

    A ClientToken object containing the URL and token needed to connect to the document.