@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| Member | Type | Summary |
|---|---|---|
| bootstrap | CollaborationBootstrap | |
| identity | CollaborationIdentity | |
| offlineEditing? | boolean | Admit local edits while the transport is `disconnected`. Buffered updates merge on reconnect. See [CreateDocumentCollaborationOptions.offlineEditing](CreateDocumentCollaborationOptions.offlineEditing). |
| roomId | string | |
| syncedTimeoutMs? | number | Bound 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. |
| url | string | Hocuspocus server WebSocket URL, for example `wss://collab.example.test`. |
HocuspocusCollaborationRoominterfaceSource ↗
Owned Hocuspocus provider and provider-neutral collaboration resources.
interface HocuspocusCollaborationRoom extends DocumentCollaborationHandle| Member | Type | Summary |
|---|---|---|
| provider | HocuspocusProvider | |
| ydoc | Y.Doc |