Skip to content

@moq/net

npmTypeScript

The networking layer for Media over QUIC in TypeScript: real-time pub/sub with built-in caching, fan-out, and prioritization, on top of QUIC. At session setup it negotiates one of two wire protocols: the simplified moq-lite protocol or the full IETF moq-transport protocol.

Overview

@moq/net is the browser equivalent of the Rust moq-net crate, providing the core networking layer for MoQ. For higher-level media functionality, use @moq/hang.

Installation

bash
bun add @moq/net
# or
npm add @moq/net
pnpm add @moq/net
yarn add @moq/net

Quick Start

Basic Connection

See js/net/examples/connection.ts

Publishing Data

See js/net/examples/publish.ts

Subscribing to Data

See js/net/examples/subscribe.ts

Stream Discovery

See js/net/examples/discovery.ts

Core Concepts

Broadcasts

A collection of related tracks.

Tracks

Named streams within a broadcast, published by the producer and consumed via subscribe.

Groups

Collections of frames (usually aligned with keyframes).

Frames

Individual data chunks.

See the publishing example for usage of all core concepts.

Advanced Usage

Authentication

Pass JWT tokens via query parameters in the URL. See Authentication guide for details and js/token/examples/sign-and-verify.ts for a working example.

Running Server-Side

@moq/net can also run server-side using a WebTransport polyfill. See the js/net/README.md for setup instructions.

Browser Compatibility

Requires WebTransport support:

  • Chrome 97+
  • Edge 97+
  • Brave (recent versions)

Firefox and Safari support is experimental or planned.

Examples

For more examples, see:

Protocol Specification

See the moq-lite specification for protocol details.

Next Steps

Licensed under MIT or Apache-2.0