y-openrtc
Yjs collaboration over one activated OpenRTC room
y-openrtc connects a Yjs document to an already activated OpenRTC room. The provider does not create a hidden client, space, room, or lifecycle owner.
Install
pnpm add openrtc y-openrtc yjs
Use
import * as Y from 'yjs';
import { OpenRTC } from 'openrtc';
import { YProvider } from 'y-openrtc';
const rtc = OpenRTC({ apiKey });
const room = await rtc.rooms.join('document-42', {
access: 'capability',
membership: 'ephemeral',
});
const doc = new Y.Doc();
const provider = new YProvider({ doc, room });
// Later
provider.destroy();
await room.leave();
await rtc.close();
Yjs owns conflict-free document merging. OpenRTC owns the active peer avenue and transport. Durable application documents still belong in your product storage.