CollabReferenceCollab serverClasses

CollabAuthority

Class: CollabAuthority<Transaction>

Defined in: packages/collab-server/src/index.ts:104

The CollabAuthority manages most of Pitter Patter's server side collaborative editing operations.

You create endpoints that call the appropriate CollabAuthority functions to integrate with a CollabClient.

A CollabAuthority is designed to be stateless, so you can create a new one on every server, lambda, or cloud function instance.

Type Parameters

Transaction

Transaction

Constructors

Constructor

new CollabAuthority<Transaction>(config: CollabAuthorityConfig<Transaction>): CollabAuthority<Transaction>;

Defined in: packages/collab-server/src/index.ts:114

Parameters

config

CollabAuthorityConfig<Transaction>

Returns

CollabAuthority<Transaction>

Methods

listenForCommit()

listenForCommit(docId: string, version: number): Promise<CommitJSON[]>;

Defined in: packages/collab-server/src/index.ts:187

Listens for remote changes to a document's editor state and returns when changes are found or after a timeout specified in the CollabAuthority's broadcastManager.

Parameters

docId

string

version

number

Returns

Promise<CommitJSON[]>


receiveCommit()

receiveCommit(docId: string, commitJSON: CommitJSON): Promise<void>;

Defined in: packages/collab-server/src/index.ts:143

Receives a commit from a CollabClient and merges it into the remote editor state.

Parameters

docId

string

commitJSON

CommitJSON

Returns

Promise<void>


runWithTransactionRetries()

runWithTransactionRetries<Result>(callback: (tr: Transaction) => Promise<Result>): Promise<Result>;

Defined in: packages/collab-server/src/index.ts:125

Type Parameters

Result

Result

Parameters

callback

(tr: Transaction) => Promise<Result>

Returns

Promise<Result>

On this page