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

@fugue-rpc/transport

v0.1.0

Published

gRPC-over-WebSocket client transport for browsers and Node.js

Downloads

112

Readme

@fugue-rpc/transport

Browser and Node.js WebSocket transport for gRPC — all four call kinds from the browser.

Unlike gRPC-Web and Connect-ES, fugue supports client-streaming and bidirectional streaming from browsers. Those libraries cannot: the Fetch API buffers request bodies, preventing true client-initiated streams. Fugue uses a single long-lived WebSocket instead.

Installation

npm install @fugue-rpc/transport

Quick start

import { FugueTransport } from "@fugue-rpc/transport";

const transport = new FugueTransport("ws://localhost:8080/fugue/");

Create one transport per server connection. It manages a single WebSocket and multiplexes all streams over it.

Unary

const result = await transport
  .openStream("/greet.v1.Greeter/SayHello")
  .unary(requestBytes, decode);

Server streaming

const stream = transport
  .openStream("/greet.v1.Greeter/ListReplies")
  .serverStream(requestBytes, decode);

for await (const msg of stream) {
  console.log(msg);
}

Client streaming

const cs = transport
  .openStream("/greet.v1.Greeter/CollectHellos")
  .clientStream(encode, decode);

cs.send(item1);
cs.send(item2);
const reply = await cs.closeAndReceive();

Bidirectional streaming

const bidi = transport
  .openStream("/greet.v1.Chat/Chat")
  .bidiStream(encode, decode);

bidi.send(msg1);
bidi.send(msg2);
bidi.halfClose(); // signal end-of-client-stream

for await (const reply of bidi) {
  console.log(reply);
}

Closing

transport.close(); // close the WebSocket connection

Options

const transport = new FugueTransport("ws://...", {
  debug: true,      // log frame-level events
  protocols: [...], // WebSocket subprotocols
});

Error handling

All calls throw GrpcStatusError on non-OK gRPC status:

import { GrpcStatusError } from "@fugue-rpc/transport";

try {
  await transport.openStream("/...").unary(req, decode);
} catch (err) {
  if (err instanceof GrpcStatusError) {
    console.log(err.code, err.message, err.metadata);
  }
}

With generated clients

Use protoc-gen-fugue to generate typed wrappers from .proto files:

import { sayHello } from "@gen/greet/v1/greeter_fugue.js";

const reply = await sayHello(transport, { name: "world" });

React

Use @fugue-rpc/react for hooks (useUnary, useServerStream, useBidiStream).

Wire protocol

Fugue uses a custom binary framing protocol over WebSocket. See the wire format spec for the frame layout. The wire-level package identifier is grpcws.frame.v1 — this is part of the protocol identity and is not renamed with the library.

License

MIT