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

rtc.io-server

v1.2.0

Published

Signaling server for the rtc.io WebRTC client. Built on socket.io.

Downloads

564

Readme

rtc.io-server

Node signaling server for rtc.io. Thin wrapper on top of socket.io that wires up the rtc.io signaling protocol.

npm install rtc.io-server

Usage

import { Server } from "rtc.io-server";

const server = new Server({ cors: { origin: "*" } });

server.on("connection", (socket) => {
  socket.on("join-room", ({ roomId, name }) => {
    socket.data.name = name;
    socket.join(roomId);
    // Tell every existing peer in the room to initiate an offer to the new one.
    socket.to(roomId).emit("#rtcio:init-offer", { source: socket.id });
  });

  // No `disconnecting` handler needed for peer cleanup — the rtc.io-server
  // core emits `#rtcio:peer-left` automatically. Add one only if you have
  // app-level cleanup (presence rosters, room password registries, etc.).
});

server.listen(3001);

What this server does

The rtc.io client multiplexes all WebRTC signaling (offers, answers, ICE candidates, stream metadata) into a single #rtcio:message event. This server registers default handlers that:

  1. Relay #rtcio:message envelopes to the addressed peer (socket.to(target).emit(...)).
  2. Emit a #rtcio:peer-left notification to a leaving socket's rooms on disconnecting, so existing peers can short-circuit ICE consent-freshness (~30 s) when a tab closes. The client treats this as a hint that's cross-checked against the local WebRTC state; it never tears down a healthy P2P call on the basis of a signaling-only event. See the signaling protocol for the full contract.

Everything else — room management, app-level events, presence — is your code.

What you implement

  • Room/lobby logic. socket.join(roomId), fan-out on join, presence broadcasts.
  • The #rtcio:init-offer kickoff. When a new peer joins a room, emit this to existing peers so they initiate offers to the newcomer. The client listens for it and starts the WebRTC handshake.
  • App-level events. Chat persistence, auth, etc.

The server has no opinion about any of these — it's just a relay.

API

import { Server, ServerOptions, RtcioEvents } from "rtc.io-server";
  • Server — extends socket.io's Server. Same options. addDefaultListeners is attached automatically on every connection.
  • RtcioEvents — string constants for the rtc.io reserved event names (use RtcioEvents.INIT_OFFER instead of typing "#rtcio:init-offer" by hand).
  • addDefaultListeners(socket) — registers the message-relay handler. Called automatically; expose for advanced use.

Wire compatibility

This server speaks the rtc.io signaling protocol — pair it with rtc.io@^1.1.0 clients. The envelope format changed in 1.1, so older clients are not wire-compatible.

License

MIT