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

@yrzhao/aves-core

v1.1.0

Published

WebRTC client library for real-time communication

Readme

Aves Core

Browser WebRTC client library for peer-to-peer rooms. @yrzhao/aves-core connects to an aves-node signaling server, builds a full-mesh WebRTC topology, and provides typed APIs for messages, file transfer, voice, video, screen sharing, reconnect restore, and diagnostics.

Version: 1.1.0

Install

npm install @yrzhao/aves-core

Quick Start

import { AvesClient } from "@yrzhao/aves-core";

const client = new AvesClient({
  signalingUrl: "wss://signal.example.com",
  iceServers: [
    { urls: "stun:stun.l.google.com:19302" },
    {
      urls: "turn:turn.example.com:3478",
      username: "turn-user",
      credential: "turn-password",
    },
  ],
});

client.on("message", (peerId, message) => {
  console.log("message from", peerId, message);
});

client.on("error", (error) => {
  console.error(error.code, error.stage, error.message);
});

const roomId = await client.createRoom();
await client.joinRoom(roomId, "Alice");

await client.waitForPeer("peer-user-id");
client.sendMessage({ text: "hello" });

What It Does

  • Creates and joins signaling rooms through aves-node.
  • Builds direct WebRTC peer connections between every participant in a room.
  • Sends JSON messages over a data channel.
  • Sends files over a dedicated file data channel.
  • Captures and forwards microphone, camera, and screen-share tracks.
  • Restores room membership after transient signaling disconnects.
  • Emits typed events for application state and errors.
  • Exposes connection snapshots for diagnostics panels and smoke tests.

What It Does Not Do

  • It does not host a signaling server. Use @yrzhao/aves-node.
  • It does not relay media or data traffic. Peers communicate directly.
  • It does not replace TURN. Production networks still need TURN fallback.
  • It does not encrypt beyond WebRTC/WebSocket transport guarantees. Use HTTPS/WSS.
  • It is not an SFU. Full-mesh rooms are best for small groups.

Core API

Rooms

const roomId = await client.createRoom();
const existingParticipants = await client.joinRoom(roomId, "Alice");
await client.leaveRoom();
client.destroy();

Messages

client.sendMessage({ kind: "chat", text: "hello" });
client.sendMessageToPeer(peerId, { kind: "private", text: "hi" });

Peer Readiness And Diagnostics

await client.waitForPeer(peerId, { timeoutMs: 10000 });

const snapshot = client.getConnectionSnapshot();
console.log(snapshot.signalingConnected, snapshot.peers);

Files

await client.sendFile(file, {
  fileName: file.name,
  mimeType: file.type || "application/octet-stream",
});

client.on("fileTransferProgress", (_peerId, progress) => {
  console.log(Math.round(progress.progress * 100));
});

Media

await client.startVoice();
client.setMuted(true);
client.stopVoice();

await client.startVideo({ width: 1280, height: 720, frameRate: 30 });
client.setVideoMuted(true);
client.stopVideo();

await client.startScreenShare();
client.stopScreenShare();

Configuration

new AvesClient({
  signalingUrl: "wss://signal.example.com",
  iceServers: [{ urls: "stun:stun.l.google.com:19302" }],
  fileChunkSize: 16 * 1024,
  video: { width: 1280, height: 720, frameRate: 30 },
  reconnect: {
    maxAttempts: 5,
    delay: 3000,
    requestTimeoutMs: 30000,
  },
  debug: false,
});

Events

| Event | Arguments | | --- | --- | | signalingStateChange | (state) | | userJoined | (participant) | | userLeft | (userId) | | connectionStateChange | (peerId, state) | | dataChannelStateChange | (peerId, state) | | message | (peerId, message) | | remoteAudioTrack / remoteVideoTrack | (peerId, stream, track) | | localAudioStateChange / localVideoStateChange | (state) | | screenShareStateChange | (state) | | fileTransferStarted / fileTransferProgress / fileTransferCompleted / fileTransferFailed | transfer lifecycle payloads | | error | (AvesError) |

Production Notes

  • Use HTTPS for the web app and WSS for signaling.
  • Configure TURN for restrictive NATs, enterprise networks, and mobile carriers.
  • Keep rooms small. Full mesh requires each peer to maintain one connection to every other peer.
  • Prefer small to medium files over data channels. Very large files need application-level resume/retry UX.
  • Test Safari and mobile browsers separately if they are target platforms.

See PRODUCTION.md and TROUBLESHOOTING.md.

Browser Support

Modern Chromium, Firefox, and Safari versions with WebRTC, DataChannel, getUserMedia, and getDisplayMedia support. Screen sharing and media permissions vary by browser and platform.

MIT