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

muxws

v0.4.6

Published

Multiplexed, cancellable, bidirectional streams over one WebSocket

Readme

muxws

Multiplexed streams over one WebSocket, with HTTP/2 and HTTP/3 stream semantics. muxws carries many independent, cancellable, bidirectional streams on one socket; either end can open a stream. It needs no QUIC or HTTP/3 stack. muxws is defined by its wire format. Python and TypeScript implementations are in this repository; SPEC.md and conformance/ specify the protocol for further implementations.

muxws copies the stream semantics of HTTP/2 and HTTP/3, not their transport. A connection runs over one TCP socket or one Unix domain socket, so all streams share one global message order and there is no per-stream loss recovery. Rationale lists which parts of the HTTP model muxws copies and which it does not; Comparison compares the two protocols frame by frame. muxws does not route requests, serialize domain objects, authenticate peers, store messages durably or define RPC services.

Install

pip install muxws                       # extras: [starlette], [websockets], [msgpack]
npm install muxws                       # optional peers: ws, @msgpack/msgpack

Example

A FastAPI acceptor (pip install "muxws[starlette]" fastapi uvicorn) that answers one payload with one reply and another with a stream of chunks:

from fastapi import FastAPI, WebSocket
from muxws import accept, Stream

app = FastAPI()

async def on_stream(payload: object, stream: Stream) -> None:
    if payload == {"say": "hello"}:
        await stream.reply({"greeting": "hello, muxws"})
    elif isinstance(payload, dict) and isinstance(payload.get("count"), int):
        for n in range(1, payload["count"] + 1):
            await stream.send({"chunk": n})
        await stream.end()

@app.websocket("/ws")
async def muxws_endpoint(websocket: WebSocket) -> None:
    peer = await accept(websocket)
    peer.on_stream(on_stream)
    await peer.serve()

A Node dialer (npm install muxws ws); a browser imports connect from muxws instead:

import 'muxws';
import { connect } from 'muxws/node';

const peer = await connect('ws://127.0.0.1:8000/ws');
const answer = await peer.request<{ greeting: string }>({ say: 'hello' }, { timeoutMs: 5000 });
for await (const chunk of peer.open<{ chunk: number }>({ count: 3 }, { end: true })) {
  console.log(chunk.chunk);
}
await peer.close();

The Getting started guide runs both and adds a Python dialer.

Documentation

The manual is at docs.velis.si/muxws. npm run docs:dev builds and serves it locally.

| | | |---|---| | A server and a client in three files | Getting started | | A browser demo, a Unix-socket demo and a throughput benchmark | Demos | | Every public symbol in both languages | API reference | | The normative rules and the conformance fixtures for new implementations | SPEC.md, conformance/ | | Changes per release, and the changes required when upgrading | Changelog, Migration guide |

Demo

Open in GitHub Codespaces

Run locally

Requirements: uv, Node 22+.

git clone https://github.com/velis74/muxws.git && cd muxws
uv sync
npm ci
uv run python demo.py --browser    # then open http://127.0.0.1:5173

Status

Alpha. The wire protocol and the packages are versioned independently:

  • Wire protocol: generation 1, frozen. The WebSocket subprotocol is muxws.v1.<codec>. The v1 changes only with a breaking wire change.
  • Packages: version 0.x. Version 1.0 follows the first confirmed production deployment.

Packages: muxws on PyPI; muxws on npm, with the browser entry point and the muxws/node and muxws/msgpack subpaths.

Licence

MIT. Copyright © 2025 Jure Erznožnik.