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

@serve-tools/signal-shared-http-stream

v0.2.2

Published

SharedWorker HTTP stream clients with subscription Signal state

Readme

@serve-tools/signal-shared-http-stream

Share one transport client across tabs while each page owns its reactive view of live presence. Use these three modules in the same directory and compile the TypeScript before opening the page. The remote endpoint must implement the @serve-tools/server-http-stream protocol.

// protocol.ts
export type PresenceProtocol = { subscriptions: { presence(room: string): { online: number } } };
// presence.worker.ts
import { listen } from "@serve-tools/signal-shared-http-stream/scope/shared-worker";
import type { PresenceProtocol } from "./protocol.js";

listen<PresenceProtocol>("https://example.com/realtime");
// page.ts
import { effect } from "@serve-tools/signal-effect";
import { connect, observe } from "@serve-tools/signal-shared-http-stream";
import type { PresenceProtocol } from "./protocol.js";

const worker = new SharedWorker(new URL("./presence.worker.js", import.meta.url), { type: "module" });
const client = connect<PresenceProtocol>(worker.port);
const presence = observe(client, "presence", { input: "lobby" });
const output = document.createElement("output");
document.body.append(output);
const stop = effect(() => {
	const state = presence.get();
	output.value = state.status === "ready" ? `${state.value.online} online` : state.status === "error" ? `Failed: ${String(state.error)}` : state.status;
});

addEventListener("pagehide", () => {
	stop();
	presence.dispose();
	client.close();
	worker.port.close();
});

Open the page in two tabs: each has an independent output and observation, backed by the same named worker and remote connection. The effect renders the watched state; Signal-aware UI libraries can consume the same observation directly.

This first example owns one active page connection and retires it on pagehide. Cached-page restoration requires a fresh client and observation; follow the back/forward-cache reconnection recipe.

Install

npm install @serve-tools/signal-shared-http-stream @serve-tools/signal-effect

Import from a CDN

import * as signalSharedHttpStream from "https://esm.run/@serve-tools/signal-shared-http-stream";

Use listen() from /scope/shared-worker, then import connect() and observe() together from the package root or /scope/window. Dispose each observation before closing its page client.

Ownership and package choice

The worker owns the physical connection; the page owns its client, observation, and message port. Closing one page client does not close the connection used by other pages. Use @serve-tools/signal-http-stream for a page-owned connection, or @serve-tools/client-shared-http-stream for every subscription occurrence without Signals. Reliable observations start pending and can become ready, complete, or error.

Agent Skill

The package includes an Agent Skill at skills/serve-tools-signal-shared-http-stream.

License

MIT-0