@docx-editor.dev/pro/collaboration/webrtc
Peer-to-peer convenience wrapper: one owned y-webrtc 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;createWebrtcCollaborationfunctionSource ↗
Create one owned y-webrtc room and provider-neutral collaboration session.
declare function createWebrtcCollaboration(options: CreateWebrtcCollaborationOptions): Promise<WebrtcCollaborationHandle>;validateRoomIdfunctionSource ↗
Validate and normalize a room identifier from a host interface.
declare function validateRoomId(value: string): string;Interfaces (2)
CreateWebrtcCollaborationOptionsinterfaceSource ↗
Options for the owned WebRTC collaboration convenience wrapper.
interface CreateWebrtcCollaborationOptions| Member | Type | Summary |
|---|---|---|
| bootstrap | CollaborationBootstrap | Create the room from a document, or join one that peers already hold. |
| iceServers? | readonly RTCIceServer[] | STUN and TURN servers for the peer connections. Use TURN across restrictive networks. |
| identity | CollaborationIdentity | Who this participant is, as peers see them. |
| offlineEditing? | boolean | Admit 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). |
| password? | string | Signaling encryption secret for `y-webrtc`. |
| roomId | string | The room to join: a `createCollaborationRoomId` value every participant shares. |
| signaling? | readonly string[] | Signaling server URLs that introduce peers to each other. |
WebrtcCollaborationHandleinterfaceSource ↗
Owned WebRTC provider and provider-neutral collaboration resources.
interface WebrtcCollaborationHandle extends DocumentCollaborationHandle| Member | Type | Summary |
|---|---|---|
| provider | WebrtcProvider | The owned `y-webrtc` provider. `destroy()` destroys it. |
| subscribeUnsyncedChanges | | Call `listener` when `unsyncedChanges()` changes. Returns the unsubscribe function. |
| unsyncedChanges | | Local changes no peer has received: made while no peer was connected, and not synced since. A WebRTC room has no server, so these changes exist only in this browser. |
| ydoc | Y.Doc | The room's shared Yjs document, owned by this handle. |
Variables (1)
DEMO_SIGNALING_ENDPOINTSconstSource ↗
Public demo signaling endpoints. Use these endpoints for demos only.
Production deployments must pass their own signaling URLs and TURN servers. WebRTC peers cannot connect across many networks without TURN.
DEMO_SIGNALING_ENDPOINTS: readonly string[]