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

@moqtap/codec

v0.2.1

Published

MoQT wire-format codec and session state machine — multi-draft, zero dependencies

Readme

@moqtap/codec

MoQT (Media over QUIC Transport) wire-format codec and session state machine for JavaScript/TypeScript.

  • Multi-draft support (drafts 07 through 17)
  • Stateless encode/decode of all MoQT control messages and data streams
  • Protocol session state machine with FSM-based validation per draft
  • Zero runtime dependencies
  • Works in Node.js, Bun, and browsers
  • Full TypeScript types with discriminated unions

Install

npm install @moqtap/codec

Quick Start

MoQT is pre-RFC, so a draft version must always be specified. Use draft-scoped imports for the best experience:

import { createDraft07Codec } from '@moqtap/codec/draft7';

const codec = createDraft07Codec();

// Decode a message from bytes
const result = codec.decodeMessage(bytes);
if (result.ok) {
  console.log(result.value.type); // e.g. 'subscribe'
}

// Encode a message to bytes
const encoded = codec.encodeMessage({
  type: 'client_setup',
  supportedVersions: [0xff000007n],
  parameters: new Map(),
});

Or use the factory if your application supports multiple drafts:

import { createCodec } from '@moqtap/codec';

const codec = createCodec({ draft: '17' }); // '07' through '17'

Subpath Exports

Each draft is available as a subpath import with its own codec and session state machine:

| Import path | Description | |---|---| | @moqtap/codec | Factory + shared types (createCodec({ draft })) | | @moqtap/codec/draft7 | Draft-07 codec | | @moqtap/codec/draft8 | Draft-08 codec | | @moqtap/codec/draft9 | Draft-09 codec | | @moqtap/codec/draft10 | Draft-10 codec | | @moqtap/codec/draft11 | Draft-11 codec | | @moqtap/codec/draft12 | Draft-12 codec | | @moqtap/codec/draft13 | Draft-13 codec | | @moqtap/codec/draft14 | Draft-14 codec | | @moqtap/codec/draft15 | Draft-15 codec | | @moqtap/codec/draft16 | Draft-16 codec | | @moqtap/codec/draft17 | Draft-17 codec | | @moqtap/codec/draft{N}/session | Session state machine for draft N |

Note: A default (versionless) codec will be available once the MoQT specification reaches RFC status. Until then, always specify a draft version.

Draft-Specific Imports

For applications targeting a single draft version:

import { createDraft17Codec } from '@moqtap/codec/draft17';
import { createDraft17SessionState } from '@moqtap/codec/draft17/session';

Session State Machine

Validate protocol message sequences without transport coupling:

import { createDraft17SessionState } from '@moqtap/codec/draft17/session';
import { createDraft17Codec } from '@moqtap/codec/draft17';

const codec = createDraft17Codec();
const session = createDraft17SessionState({ codec, role: 'client' });

const result = session.receive(incomingMessage);
if (!result.ok) {
  console.error('Protocol violation:', result.violation);
}

License

MIT