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

@forinda/video-sdk-signaling-adapter-ws

v0.1.2

Published

Node WebSocket server adapter for Forinda video SDK signaling protocol

Readme

@forinda/video-sdk-signaling-adapter-ws

Node ws-backed WebSocket signaling server adapter for the Forinda RTC SDK. Wires a SignalingEngine to a real WebSocketServer so any WebRTC client built with @forinda/video-sdk-core (or @forinda/video-sdk-react, or @forinda/video-sdk-elements) can negotiate against it.

For a no-config "just give me a server" experience, use @forinda/video-sdk-signaling-server — it wraps this adapter with a CLI and sensible defaults. Use this package directly when you want to run the adapter inside an existing Node process or share a WebSocketServer with another protocol.

Install

pnpm add @forinda/video-sdk-signaling-adapter-ws @forinda/video-sdk-signaling-protocol ws

Peer dep: ws@^8. Node ≥ 20.

Quick start

Stand up a server on its own port:

import { defineWebSocketSignalingServer } from "@forinda/video-sdk-signaling-adapter-ws";

const server = defineWebSocketSignalingServer({ port: 8787 });

console.log(`signaling on ws://127.0.0.1:${(server.wss.address() as { port: number }).port}`);

process.on("SIGTERM", async () => {
  await server.close();
  process.exit(0);
});

Or share an existing WebSocketServer (e.g. one already mounted on your HTTP server):

import { WebSocketServer } from "ws";
import { defineWebSocketSignalingServer } from "@forinda/video-sdk-signaling-adapter-ws";

const wss = new WebSocketServer({ port: 8080 });
const server = defineWebSocketSignalingServer({ wss });
// server.wss === wss

API

defineWebSocketSignalingServer(options)WebSocketSignalingServer

| Option | Type | Default | Description | | ----------------- | ----------------------------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------ | | wss | WebSocketServer | created on port | Bring your own ws server. Required when port is omitted. | | port | number | — | Bind a freshly-created WebSocketServer to this port. Use 0 for an OS-assigned port. | | engine | SignalingEngine | defineSignalingEngine({...}) | Pre-built engine. When omitted, the adapter constructs one passing authenticate + maxPeersPerRoom below. | | authenticate | AuthenticateFn | allow-all | Per-join auth callback. Forwarded to the default engine; ignored when engine is supplied. | | maxPeersPerRoom | number | 50 | Capacity. Forwarded to the default engine; ignored when engine is supplied. | | socketId | (req: IncomingMessage) => string | crypto.randomUUID() | Per-connection identifier (used internally by the engine for routing). | | extractToken | (req: IncomingMessage) => string \| undefined | reads ?token= from request URL | Pulls the auth token off the upgrade request before passing to authenticate. |

The handle returned has:

| Field | Type | Purpose | | --------- | --------------------- | ----------------------------------------------- | | wss | WebSocketServer | The underlying ws server (yours or new). | | engine | SignalingEngine | The engine driving validation and routing. | | session | Session | The single shared session for all sockets. | | close() | () => Promise<void> | Drain clients, detach listeners, close the wss. |

Authentication

const server = defineWebSocketSignalingServer({
  port: 8787,
  authenticate: async (token, room) => {
    if (token === undefined) return false;
    const claims = await verifyJwt(token);
    return claims.allowedRooms.includes(room);
  },
});

Tokens are extracted from ?token=… on the WebSocket upgrade URL by default. Override extractToken to pull from a header or cookie:

defineWebSocketSignalingServer({
  port: 8787,
  extractToken: (req) => req.headers["x-room-token"]?.toString(),
  authenticate: (token, room) => verifyJwt(token, room),
});

What it doesn't do

  • No HTTP layer. Use @forinda/video-sdk-signaling-adapter-express when you need an Express HTTP app sharing the same port, or wrap your own http.Server and pass its WebSocketServer via wss.
  • No persistence. Rooms and presence live in-process. For horizontal-scale deployments you'll need a Redis pub/sub layer (on the roadmap).
  • No rate limiting. Per-peer rate limits are on the roadmap. Until then, gate at the WebSocket layer (ws's maxPayload, OS-level connection limits, or a reverse-proxy quota).

License

MIT.