# @univerjs-pro/collaboration-client

- Human documentation: [https://docs.univer.ai/reference/packages/plugins/univerjs-pro/collaboration-client](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/collaboration-client)

- Agent Markdown: [https://docs.univer.ai/reference/packages/plugins/univerjs-pro/collaboration-client.md](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/collaboration-client.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [packages/plugins/univerjs-pro/collaboration-client.mdx](https://github.com/dream-num/documentation/blob/dev/content/reference/packages/plugins/univerjs-pro/collaboration-client.mdx)

---

Client-side collaboration plugin for Web SDK.

```typescript
// [!code word:UniverCollaborationClientPlugin]
// [!code word:IUniverCollaborationClientConfig]
import type { IUniverCollaborationClientConfig } from '@univerjs-pro/collaboration-client'
import { UniverCollaborationClientPlugin } from '@univerjs-pro/collaboration-client'
import { BrowserCollaborationSocketService } from '@univerjs-pro/collaboration-client-ui'

const config: IUniverCollaborationClientConfig = {
  socketService: BrowserCollaborationSocketService,
}
univer.registerPlugin(UniverCollaborationClientPlugin, config)
```

`socketService` is required. Browser clients can use `BrowserCollaborationSocketService`; other hosts must provide their own `ICollaborationSocketService` implementation.

## Entry Points

* Facade: `@univerjs-pro/collaboration-client/facade`
* Locale: `@univerjs-pro/collaboration-client/locale/*`

The Facade entry exposes host-specific loaders for Sheets, Docs, Bases, Slides, Boards, and PDFs, including `loadPdfAsync(unitId, context?)`.

## IUniverCollaborationClientConfig

```ts
import type { Ctor, DependencyOverride } from '@univerjs/core'
import type { ICollaborationSocketService } from '../services/socket/collaboration-socket.service'

export interface IUniverCollaborationClientConfig {
  /**
   * Which socket should the plugin use to build connections to the collaborative engine.
   * For normal cases, you should use `BrowserCollaborationSocketService` from the `collaboration-client-ui` plugin.
   */
  socketService: Ctor<ICollaborationSocketService>

  /**
   * If the plugin should enable collaborative editing. Which means the client will exchange edits with
   * the collaboration server. It this is set to false, the client will simply load data from the server.
   *
   * @default true
   */
  enableCollaboration?: boolean

  /**
   * If offline editing is enabled.
   * @default false
   */
  enableOfflineEditing?: boolean
  enableSingleActiveInstanceLock?: boolean
  enableAuthServer?: boolean
  /**
   * Override internal modules with custom implementations.
   */
  override?: DependencyOverride

  sendChangesetTimeout?: number
  snapshotServerUrl?: string
  collabSubmitChangesetUrl?: string
  collabWebSocketUrl?: string
  /**
   * The URL of the endpoint for getting the websocket session ticket.
   */
  wsSessionTicketUrl?: string
  loginUrlKey?: string
  retryConnectingInterval?: number
  authzUrl?: string

  /**
   * The URL of the endpoint for downloading files.
   * @default 'location.origin'
   */
  downloadEndpointUrl?: string
  uploadFileServerUrl?: string
  signUrlServerUrl?: string

  /**
   * The URL of the endpoint for starting formula limit.
   */
  startFormulaLimitUrl?: string

  /**
   * The URL of the endpoint for getting formula limit status.
   */
  getFormulaLimitStatusUrl?: string

  /**
   * The URL of the endpoint for releasing formula limit.
   */
  releaseFormulaLimitUrl?: string

  /**
   * The socket connection custom headers.
   */
  customHeaders?: Record<string, string>
}
```
