Collaborative Editor
Reliable Yjs updates over one OpenRTC room handle
const rtc = OpenRTC({ apiKey });
const room = await rtc.rooms.join('document-42');
const doc = new Y.Doc();
const provider = new YProvider({ doc, room });
Yjs owns merge semantics and reliable CRDT updates. y-openrtc consumes the activated room rather than creating a hidden client or secondary avenue. Persist the document in application storage if it must survive all peers leaving.
provider.destroy();
await room.leave();
await rtc.close();