@docx-editor.dev/pro/collaboration/hocuspocus

Server-backed convenience wrapper: one owned Hocuspocus room over the full-document collaboration replica.

Functions (3)

createCollaborationRoomIdfunctionSource ↗

Create a cryptographically strong room identifier. It is not an authorization token.

declare function createCollaborationRoomId(): string;

createHocuspocusCollaborationfunctionSource ↗

Create one owned Hocuspocus room and provider-neutral collaboration session.

declare function createHocuspocusCollaboration(options: CreateHocuspocusCollaborationOptions): Promise<HocuspocusCollaborationRoom>;

validateRoomIdfunctionSource ↗

Validate and normalize a room identifier from a host interface.

declare function validateRoomId(value: string): string;

Interfaces (2)

CreateHocuspocusCollaborationOptionsinterfaceSource ↗

Options for the owned Hocuspocus collaboration convenience wrapper.

interface CreateHocuspocusCollaborationOptions
MemberTypeSummary
bootstrapCollaborationBootstrapWhether to seed the room, join it, or let the peers decide.
identityCollaborationIdentityThe local participant. Recorded as the author of this replica's changes.
offlineEditing?booleanAdmit local edits while the transport is `disconnected`. Buffered updates merge on reconnect. On by default; pass `false` to pause editing while disconnected. See [CreateDocumentCollaborationOptions.offlineEditing](CreateDocumentCollaborationOptions.offlineEditing).
roomIdstringRoom name on the server, also the document id. Make one with `createCollaborationRoomId`.
syncedTimeoutMs?numberBound on the wait for the server's initial sync in the `join` and `create-or-join` flows. Default 30000 ms. On expiry the factory destroys everything it owns and rejects with the failure code `initialization-timeout`.
token?string | (() => string | Promise<string>)Authentication token the provider sends in its auth handshake. The server queues all traffic until that message arrives, so the provider always sends one; omit this and it sends an empty token. Pass a callback and the provider re-evaluates it on every reconnect, which is how expiring JWTs renew.
urlstringHocuspocus server WebSocket URL, for example `wss://collab.example.test`.

HocuspocusCollaborationRoominterfaceSource ↗

Owned Hocuspocus provider and provider-neutral collaboration resources.

interface HocuspocusCollaborationRoom extends DocumentCollaborationHandle
MemberTypeSummary
providerHocuspocusProviderThe connected provider. `destroy()` destroys it.
ydocY.DocThe room's Yjs document. `destroy()` destroys it.