Skip to main content
rtc.io

WebRTC client · signaling server · socket.io ergonomics

Peer-to-peer media and data,
behind emit & on.

Browser-to-browser streams, broadcast and per-peer DataChannels, file transfers, late-joiner replay, perfect negotiation — all wrapped behind the socket.io API you already know. The server stays a thin signaling relay.

npm install rtc.io rtc.io-server
client.ts
import io, { RTCIOStream } from "rtc.io";

const socket = io("https://server.rtcio.dev", {
iceServers: [{ urls: "stun:stun.l.google.com:19302" }],
});

const local = await navigator.mediaDevices.getUserMedia({
video: true, audio: true,
});
const camera = new RTCIOStream(local);

socket.server.emit("join-room", { roomId: "demo", name: "alice" });

// You can ship app metadata alongside the stream — the library walks args
// for any RTCIOStream and preserves the rest of the shape verbatim.
socket.emit("camera", { stream: camera, metadata: { displayName: "Alice" } });

socket.on("camera", ({ stream, metadata }) => {
videoEl.srcObject = stream.mediaStream;
label.textContent = metadata.displayName;
});

Perfect negotiation, baked in

W3C polite/impolite roles, stale-answer detection, manual rollback fallback, automatic ICE restart on failure. You never see an offer, an answer, or an ICE candidate.

Read the guide

Channels like socket.io rooms

createChannel('chat') is a broadcast DataChannel that every peer (and any peer that joins later) shares. Per-peer channels for one-to-one. ordered/unordered, custom budgets.

DataChannels guide

Streams as first-class

emit('camera', new RTCIOStream(media)) — the library reuses transceivers, handles late joiners by replaying registered streams, and lets you toggle tracks on the fly.

Streams guide

Backpressure that actually works

High/low watermarks, a per-channel queue budget, drain events. Big file transfers don't blow up your tab; slow peers don't pin memory forever.

Backpressure guide

Self-hosted or hosted signaling

rtc.io-server is a thin socket.io extension you can drop on Heroku, Fly, or your own box. We also host server.rtcio.dev — free, public, perfect for prototypes.

Public server

No SDP wrangling

ICE candidates, transceivers, glare resolution, MID matching, stream replay — handled by the library. You write emit and on.

How it works