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-broadcast

v1.0.0

Published

Same-tab BroadcastChannel client transport for Forinda video SDK demos and tests

Readme

@forinda/video-sdk-signaling-broadcast

Same-tab SignalingTransport for the Forinda RTC SDK, built on the browser's BroadcastChannel API. Useful for demos, tests, and any case where publisher and viewer run inside the same browsing context — no signaling server needed.

If you want a real network transport (cross-machine, cross-origin), use @forinda/video-sdk-signaling-ws instead.

Install

pnpm add @forinda/video-sdk-signaling-broadcast @forinda/video-sdk-core

Peer dependencies: @forinda/video-sdk-core and @forinda/video-sdk-signaling-protocol (transitive via core).

Quick start

Two transports on the same channel name talk to each other:

import { defineBroadcastSignaling } from "@forinda/video-sdk-signaling-broadcast";
import { definePublisher, defineViewer, getUserMedia } from "@forinda/video-sdk-core";

// Publisher (in tab A or component A)
const pubSignaling = defineBroadcastSignaling({ channel: "demo-room" });
const publisher = definePublisher({
  signaling: pubSignaling,
  room: "demo",
  stream: await getUserMedia({ audio: true, video: true }),
});
await publisher.start();

// Viewer (in tab B or component B, same origin)
const viewerSignaling = defineBroadcastSignaling({ channel: "demo-room" });
const viewer = defineViewer({
  signaling: viewerSignaling,
  room: "demo",
  publisherId: publisher.peerId, // get this however you'd like
});
viewer.on("track", ({ stream }) => {
  videoEl.srcObject = stream;
});
await viewer.start();

Note: BroadcastChannel cannot bridge two different origins or two different machines. For real signaling, use @forinda/video-sdk-signaling-ws.

API

defineBroadcastSignaling(opts): BroadcastSignaling

Factory function returning a BroadcastSignaling instance that satisfies the SignalingTransport contract from @forinda/video-sdk-core. Recommended call style.

class BroadcastSignaling

Exported for type imports + instanceof checks. Prefer the factory at call sites.

Implements SignalingTransport:

interface SignalingTransport {
  state: TransportState; // "idle" | "connecting" | "connected" | "reconnecting" | "closed"
  connect(): Promise<void>;
  disconnect(): Promise<void>;
  send(message: SignalingMessageType): Promise<void>;
  on(event: "message", h: (msg: SignalingMessageType) => void): () => void;
  on(event: "state", h: (s: TransportState) => void): () => void;
}

Options

| Option | Type | Default | Notes | | --------- | -------- | -------- | ------------------------------------------------------------------------------------------------ | | channel | string | required | The BroadcastChannel name. Two transports must share the exact same string to communicate. |

That's it — no reconnect config, no heartbeat, no auth. The whole point of this transport is simplicity for local-only scenarios.

Behavior

Lifecycle

idle -> connecting -> connected -> closed

connect() synchronously transitions to connected (BroadcastChannel has no real handshake). disconnect() always reaches closed. The reconnecting state is never visited — channels don't drop while the tab is alive.

Send / receive

  • send(message) calls BroadcastChannel.postMessage(message) directly. The browser handles structured cloning; no JSON serialization happens at this layer. This means the message arrives as the same JS object structure the sender passed.
  • Inbound messages are validated against the wire-format schema from @forinda/video-sdk-signaling-protocol. Schema-failing payloads are dropped with a getLogger().warn(...) log — they never reach message handlers.
  • The transport delivers to every other transport on the same channel including transports owned by other components in the same tab. Multiple viewers, multiple publishers — all see every message.

Throwing on send while disconnected

Unlike signaling-ws (which buffers), BroadcastSignaling.send() throws when called before connect() or after disconnect(). There's no reason to buffer for a synchronous transport — if you're trying to send, you should already be connected.

Common patterns

Demo: publisher + viewer in the same React component

import { defineBroadcastSignaling } from "@forinda/video-sdk-signaling-broadcast";

function DemoLoopback() {
  const channel = useId();
  const pubSignaling = useMemo(() => defineBroadcastSignaling({ channel }), [channel]);
  const viewerSignaling = useMemo(() => defineBroadcastSignaling({ channel }), [channel]);
  // ... build publisher + viewer with these transports ...
}

Test fixture

import { defineBroadcastSignaling } from "@forinda/video-sdk-signaling-broadcast";

it("publisher↔viewer happy path", async () => {
  const channel = `test-${crypto.randomUUID()}`;
  const a = defineBroadcastSignaling({ channel });
  const b = defineBroadcastSignaling({ channel });
  // ... drive the test ...
  await a.disconnect();
  await b.disconnect();
});

Pitfalls

  • send() throws when not connected. Always await connect() first.
  • Channel names are exact strings. A typo silently produces a "no one is listening" channel.
  • Cross-origin / cross-machine doesn't work. This is by design — BroadcastChannel is local. Use @forinda/video-sdk-signaling-ws for real signaling.
  • Every transport on the channel sees every message. If you have N viewers sharing one channel, every viewer receives every other peer's traffic. This is fine for v0.1.0 (the wire format is point-to-point with explicit from/to), but not a transport for multi-room scaling.

License

MIT — © 2026 Felix Orinda.