@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.

The room reaches only the signaling servers in signaling. It never falls back to public endpoints. The first room applies the same scoping to every y-webrtc provider in the page, including providers the host creates directly. A provider created before the first room keeps its own destroy(): call its disconnect() first to close its signaling.

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
MemberTypeSummary
bootstrapCollaborationBootstrapCreate 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.
identityCollaborationIdentityWho this participant is, as peers see them.
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).
password?stringSignaling encryption secret for `y-webrtc`.
roomIdstringThe room to join: a `createCollaborationRoomId` value every participant shares.
signalingreadonly string[]Signaling server URLs that introduce peers to each other. There is no default. Pass your own URLs in production, [DEMO_SIGNALING_ENDPOINTS](DEMO_SIGNALING_ENDPOINTS) for demos, or `[]` to connect only tabs of the same browser. A call without this value rejects with a `TypeError` before any connection opens.

WebrtcCollaborationHandleinterfaceSource ↗

Owned WebRTC provider and provider-neutral collaboration resources.

interface WebrtcCollaborationHandle extends DocumentCollaborationHandle
MemberTypeSummary
providerWebrtcProviderThe owned `y-webrtc` provider. `destroy()` destroys it.
subscribeUnsyncedChangesCall `listener` when `unsyncedChanges()` changes. Returns the unsubscribe function.
unsyncedChangesLocal 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.
ydocY.DocThe room's shared Yjs document, owned by this handle.

Variables (1)

DEMO_SIGNALING_ENDPOINTSconstSource ↗

Public demo signaling endpoints. Use these endpoints for demos only.

The host is a shared, unauthenticated public service. It receives every room id and, without a password, every signaling message in plaintext. createWebrtcCollaboration never selects it for you: pass it as signaling to opt in. Production deployments pass their own signaling URLs and TURN servers. WebRTC peers cannot connect across many networks without TURN.

DEMO_SIGNALING_ENDPOINTS: readonly string[]