npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

y-openrtc

v3.3.1

Published

A Yjs provider that uses OpenRTC for room membership and peer transport.

Readme

y-openrtc

y-openrtc is a Yjs provider that feels close to y-webrtc, but uses OpenRTC for room membership and peer transport.

Install

pnpm add y-openrtc yjs

Minimal usage

import * as Y from 'yjs';
import { OpenRTC } from 'openrtc';
import { YProvider } from 'y-openrtc';

const rtc = OpenRTC({ apiKey: '<your public OpenRTC API key>' });
const room = await rtc.rooms.join('my-room', {
  access: 'capability',
  membership: 'ephemeral',
});
const doc = new Y.Doc();
const provider = new YProvider('my-room', doc, {
  room,
  // Keep offline edits across reload (document only; awareness stays live).
  persistLocalDoc: true,
});
await provider.localDocReady;

Advanced usage

import * as Y from 'yjs';
import { OpenRTC } from 'openrtc';
import { YProvider } from 'y-openrtc';

const room = await rtc.rooms.join('private-room', {
  access: 'authenticated',
  auth,
});

const doc = new Y.Doc();
const provider = new YProvider('my-room', doc, {
  room,
});

Transport and strict-mode options

Configure advanced transports on the OpenRTC client, then pass the activated room:

const rtc = OpenRTC({
  apiKey: '<your public OpenRTC API key>',
  transports: {
    iroh: true,
    webrtc: true,
    moq: { relayUrl: 'https://draft14-relay.example.com/moq' },
  },
});
const room = await rtc.rooms.join('private-room', { access: 'capability' });
const provider = new YProvider('private-room', doc, { room });

WebRTC and MoQ are custom packet carriers beneath the same Iroh endpoint. Keep TURN and MoQ credentials server-generated and short lived. Do not commit .env files or long-lived secrets.

Differences from y-webrtc

  • signaling and peerOpts are accepted for compatibility, but ignored.
  • OpenRTC remains the source of truth for room membership and peer transport.
  • Runtime connection events and room-membership changes drive peer attachment; the provider does not poll or own base-connection retries.
  • A supplied room owns discovery and dialing. Its ID determines membership; the provider's document label can be different. Provider frames use the room's scoped public connections, with a JSON envelope preserving Yjs bytes. Diagnostic transport connections are never used for document delivery.
  • Same-tab sync still prefers BroadcastChannel when available.
  • password encrypts provider payloads end-to-end on top of OpenRTC.
  • Optional persistLocalDoc stores the Yjs document body in IndexedDB so offline edits survive a browser reload. Rehydration feeds the existing sync path; it does not dial, retry, or own peer lifecycle. Awareness is never persisted.
  • Editor awareness (cursors, selections, display names) is ephemeral display data carried in the same bounded frames as document sync (64 KiB each; an oversized presence state is dropped while document sync continues). It is never application identity: use the room's member roster / authenticated node for that. Remote peers cannot write or erase the local collaborator's own awareness state. Remote presence clears when the room owner retires that peer's connection or roster entry, and when this provider leaves; after disconnect() then connect() the local awareness state is re-announced.

Live test env

The live test at tests/YProvider.live.test.ts reads package-local env values.

Create openrtc/packages/y-openrtc/.env.local with:

OPENRTC_Y_OPENRTC_API_KEY=<your public OpenRTC API key>

Then run:

pnpm --dir openrtc/packages/y-openrtc test:live

The live test only uses the public OpenRTC API key. Server secrets are not needed for this package-local live test and should stay server-side. It checks document and awareness convergence between isolated browser contexts, so BroadcastChannel cannot hide a broken network path. The separate static Hub configuration check runs only when OPENRTC_HUB_API_KEY is supplied.