@docx-editor.dev/pro/vue/webrtc
@docx-editor.dev/pro/vue/webrtc — Vue composable that owns a WebRTC room.
Import this subpath only when you use WebRTC. @docx-editor.dev/pro/vue does not load a network provider.
Functions (1)
useWebrtcCollaborationfunctionSource ↗
Own a WebRTC collaboration room for a Vue host.
The default Pro Vue entry does not import this composable. Import it from @docx-editor.dev/pro/vue/webrtc so a review-only bundle does not load a network provider.
declare function useWebrtcCollaboration(options?: MaybeRefOrGetter<UseWebrtcCollaborationOptions | null>): UseWebrtcCollaborationReturn;Interfaces (5)
CollaborationIdentityUpdateinterfaceSource ↗
Display-identity fields a live session can update.
actorId and role are attribution and stay immutable for the session lifetime, so this type cannot name them.
interface CollaborationIdentityUpdate| Member | Type | Summary |
|---|---|---|
| color? | string | |
| name? | string |
CollaborationSessioninterfaceSource ↗
Host-facing collaboration session.
A host reads identity, status, presence, and undo. The editor attaches [EditorCollaborationSession](EditorCollaborationSession) internally and never through this type.
interface CollaborationSession| Member | Type | Summary |
|---|---|---|
| canRedo | | |
| canUndo | | |
| documentId | string | |
| identity | CollaborationIdentity | |
| participants | | |
| redo | | |
| remoteSelections | | |
| sessionId | string | Unique identity for this attachment lifetime. |
| setIdentity | | Update the display name and color mid-session, when the replica supports it. |
| status | | |
| statusSnapshot | | Cached status, current reason, and last failure. |
| subscribeParticipants | | |
| subscribeRemoteSelections | | |
| subscribeStatus | | |
| undo | |
UseWebrtcCollaborationConnectOptionsinterfaceSource ↗
Arguments for [UseWebrtcCollaborationReturn.connect](UseWebrtcCollaborationReturn.connect).
interface UseWebrtcCollaborationConnectOptions| Member | Type | Summary |
|---|---|---|
| bootstrap | UseWebrtcCollaborationBootstrap | |
| iceServers? | readonly RTCIceServer[] | |
| identity | CollaborationIdentity | |
| offlineEditing? | boolean | Admit local edits while the transport is `disconnected`. Buffered updates merge on reconnect. See [CreateDocumentCollaborationOptions.offlineEditing](CreateDocumentCollaborationOptions.offlineEditing). |
| password? | string | |
| roomId | string | |
| signaling? | readonly string[] |
UseWebrtcCollaborationOptionsinterfaceSource ↗
Input for [useWebrtcCollaboration](useWebrtcCollaboration).
interface UseWebrtcCollaborationOptions| Member | Type | Summary |
|---|---|---|
| modules? | readonly EditorModule[] | Host modules. The hook adds `collaborationModule` when a room is ready. A host collaboration contribution is a configuration error and throws. |
| room? | UseWebrtcCollaborationConnectOptions | null | Connect this room when the composable starts. Omit it and call [UseWebrtcCollaborationReturn.connect](UseWebrtcCollaborationReturn.connect) after the user chooses a room. |
UseWebrtcCollaborationReturninterfaceSource ↗
Values [useWebrtcCollaboration](useWebrtcCollaboration) returns.
interface UseWebrtcCollaborationReturn| Member | Type | Summary |
|---|---|---|
| connect | (options: UseWebrtcCollaborationConnectOptions) => Promise<CollaborationFailure | null> | Connect a room. RESOLVES with the failure, or null on success — it does not reject. |
| document | Readonly<Ref<Uint8Array | null>> | |
| error | Readonly<Ref<CollaborationFailure | null>> | |
| leave | (nextDocument: Uint8Array) => void | Destroy the room and carry on editing locally. |
| modules | Readonly<Ref<readonly EditorModule[]>> | |
| pending | Readonly<Ref<boolean>> | |
| provider | Readonly<Ref<WebrtcProvider | null>> | The owned `y-webrtc` provider. Null while no room is connected. |
| rejoin | (nextDocument: Uint8Array) => Promise<CollaborationFailure | null> | Recover a session that reached status `error`: leave with `nextDocument`, then connect again to the same room with the same identity, signaling, and password. |
| session | Readonly<Ref<CollaborationSession | null>> | |
| ydoc | Readonly<Ref<Y.Doc | null>> | The room's shared Yjs document, owned by the composable. Null while no room is connected. |
Type aliases (1)
UseWebrtcCollaborationBootstraptypeSource ↗
Bootstrap for one WebRTC room.
type UseWebrtcCollaborationBootstrap = CollaborationBootstrap;