Collaboration setup
Collaboration & historyCollaboration setup
Real-time multi-user editing via Yjs.
Pass a collaboration adapter, a broadcast channel to start, or a WebSocket backend for production. Presence (cursors, avatars) and conflict handling are built in. See collaboration.
Pick a transport
- No
adapter: the editor uses the built-in broadcast adapter. It syncs over the browser's BroadcastChannel (channelmailkaro:<sessionId>), so it only reaches other tabs of the same browser on the same site. Use it to try the feature. createYjsWebSocketCollaborationAdapter: syncs through a WebSocket relay you run, see custom backend.- Your own adapter: an object whose
connect(input)returnsapplyLocalDesign,updatePresenceanddisconnect.
Session ids and users
Everyone with the same sessionId edits the same design, so build it from your design id. Keep user.id stable for each person: it is how the editor tells your own changes from someone else's.
What users see
Presence (who is here and which block they selected) is shown unless you pass showPresence: false. When a remote change arrives, a short notice names the person who made it. With the broadcast adapter, presence is sent every 4 seconds and a peer that goes quiet is dropped after 15 seconds.