@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
MemberTypeSummary
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
MemberTypeSummary
canRedo
canUndo
documentIdstring
identityCollaborationIdentity
participants
redo
remoteSelections
sessionIdstringUnique identity for this attachment lifetime.
setIdentityUpdate the display name and color mid-session, when the replica supports it.
status
statusSnapshotCached status, current reason, and last failure.
subscribeParticipants
subscribeRemoteSelections
subscribeStatus
undo

UseWebrtcCollaborationConnectOptionsinterfaceSource ↗

Arguments for [UseWebrtcCollaborationReturn.connect](UseWebrtcCollaborationReturn.connect).

interface UseWebrtcCollaborationConnectOptions
MemberTypeSummary
bootstrapUseWebrtcCollaborationBootstrap
iceServers?readonly RTCIceServer[]
identityCollaborationIdentity
offlineEditing?booleanAdmit local edits while the transport is `disconnected`. Buffered updates merge on reconnect. See [CreateDocumentCollaborationOptions.offlineEditing](CreateDocumentCollaborationOptions.offlineEditing).
password?string
roomIdstring
signaling?readonly string[]

UseWebrtcCollaborationOptionsinterfaceSource ↗

Input for [useWebrtcCollaboration](useWebrtcCollaboration).

interface UseWebrtcCollaborationOptions
MemberTypeSummary
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 | nullConnect 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
MemberTypeSummary
connect(options: UseWebrtcCollaborationConnectOptions) => Promise<CollaborationFailure | null>Connect a room. RESOLVES with the failure, or null on success — it does not reject.
documentReadonly<Ref<Uint8Array | null>>
errorReadonly<Ref<CollaborationFailure | null>>
leave(nextDocument: Uint8Array) => voidDestroy the room and carry on editing locally.
modulesReadonly<Ref<readonly EditorModule[]>>
pendingReadonly<Ref<boolean>>
providerReadonly<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.
sessionReadonly<Ref<CollaborationSession | null>>
ydocReadonly<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;

On this page