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

@rtcio/core

v0.2.0

Published

A P2P connection library aimed to make RTCPeerConnections easier to use

Readme

@rtcio/core

A P2P connection library aimed to make RTCPeerConnections easier to use.

Features

  • Built in TypeScript and is fully typed
  • Works with your custom signal server via an implemented interface
  • Binary data handling
  • Automatic data chunking with configurable chunk sizes
  • Native support for sending Files
  • Generic typed parameters for custom events listeners and emitters
  • Logging available via the debug library

Installation

npm install @rtcio/core

Usage

import { RTC } from "@rtcio/core";
import { SocketIoSignaler } from "@rtcio/socket-io-client";

const ROOM_NAME = "signalerRoom1";

// Define your own data contract here.
interface MyCustomEvents {
  // functions can be async, take any JSON serializable param,
  // but they MUST always return void. I mean, I guess they
  // don't have to. But RTC won't do anything with the data :)
  message: (messageText: string) => void;
  wantFile: () => void;
  wantData: () => void;
}

// The official SocketIoSignaler is coming soon. For now, you can
// implement your own signaler by implementing `@rtcio/signaling`
const io = new RTC<MyCustomEvents>({
  // This is an implementation of the `ClientSignaler` interface
  // from `@rtcio/signaling`. You may provide your own, or use a
  // pre-built one. More signal implementations are coming soon.
  signaler: new SocketIoSignaler(socketArgs),
  // This is the specific room you want to connect to on the signaler.
  // You will not be able to connect to peers in different rooms.
  roomName: ROOM_NAME,
  // Not required. If not present, RTC will use 4 default Google STUN
  // servers.
  iceServers: [],
  // Not required. Defaults are provided. This number represents how long
  // before we receive a new binary data packet before we consider the
  // transfer timed out.
  // !! IMPORTANT -- this is for individual packets, not the whole transfer
  dataTimeoutMs: 5_000,
  // Not required. Defaults are provided. This number represents how large
  // the chunked data packets are in bytes.
  // !! IMPORTANT -- this should be set to a sensible "happy medium" that
  // works for all browsers. If you send 64MB chunks, Safari is going to
  // have to receive that packet and it _probably_ won't be happy ;)
  maxChunkSizeBytes: 1024;
});

const idResult = await io.connectToRoom();
// This project leverages the type safe `Option` and `Result` api
// from Rust via the `@dbidwell94/ts-utils` package.
if (idResult.isError()) {
  console.error(idResult.error);
  return;
}

const myLocalId = idResult.value;

io.on("connected", (newPeer) => {
  // Emitting custom events to a remote peer
  newPeer.emit("message", "Hello, and welcome to rtcio!");

  // Subscribing to events FROM a remote peer
  newPeer.on("message", (messageText) => {
    console.log(`New message from ${newPeer.id}: ${messageText}`);
  });

  newPeer.on("wantFile", async () => {
    // Supports sending a raw `File` to a remote peer
    // via streaming directly from the file system
    // without loading the whole file into memory
    await newPeer.sendFile(yourFile);
  });

  newPeer.on("wantData", async () => {
    // Have some arbitrary data you want to send?
    // Supports sending raw `ArrayBuffer`s to a remote
    // peer and automatically handles the data chunking for you!
    await newPeer.sendRaw(yourData);
  });
});

// This event will fire when you get a connection request FROM
// a remote peer via the signal server. You may choose to accept
// or reject the connection here.
io.on("connectionRequest", async ({ accept, reject, remoteId }) => {
  if (remoteId === theIdIExpectedToGetFromMyBestBud) {
    await accept();
  } else {
    reject();
  }
})

// This will get all the current connected peers to the
// signal server's room you are in
const roomPeers = await io.getRoomPeers();

for (const peerId of roomPeers) {
  // This is how you initialize your connection to a peer.
  // This will fire the 'connectionRequest' event on the
  // remote peer
  await io.connectToPeer(peerId);
}