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

sockster

v1.1.0

Published

A small WebSocket server that broadcasts every event to all connected clients

Readme

sockster

npm Docker pulls License: MIT

A small WebSocket server that relays every event it receives to all connected clients. Point any number of Socket.IO clients at it and whatever one emits, the rest receive - no rooms to join and no server-side handlers to write.

I built it because I kept needing a realtime backend for prototypes and didn't want to write the same relay server again each time. It's a container you start, not a framework you extend.

Quick start

npm

npm install sockster
npx sockster

Configuration comes from environment variables, or from an .env file in the directory you run it from (see Configuration).

Docker

docker run -p 4000:4000 -e SOCKSTER_ORIGIN_URL=http://localhost:3000 djurnamn/sockster

Docker Compose

services:
  sockster:
    image: djurnamn/sockster:latest
    ports:
      - "4000:4000"
    environment:
      - SOCKSTER_ORIGIN_URL=http://localhost:3000

Connecting a client

Use any Socket.IO client. Events pass through as-is, so both sides just agree on event names:

import { io } from "socket.io-client";

const socket = io("http://localhost:4000");

// Everything any client emits comes back out here
socket.on("cursor-moved", ({ x, y }) => {
  drawCursor(x, y);
});

socket.emit("cursor-moved", { x: 128, y: 64 });

By default the sender receives its own events back too, which keeps every client on the same code path. If your clients render their own actions optimistically, set SOCKSTER_ECHO=false and events only go to the other clients.

Configuration

| Variable | Default | Description | |-----------------------|-------------------------|-----------------------------------------------------------------------------------------------| | SOCKSTER_PORT | 4000 | Port the server listens on | | SOCKSTER_ORIGIN_URL | http://localhost:3000 | Allowed CORS origin(s) - a single origin, a comma-separated list, or * to allow any origin | | SOCKSTER_ECHO | true | Whether events are echoed back to the client that sent them; false relays to everyone else |

Health endpoint

GET /health returns the server state:

{ "status": "ok", "uptime": 12.3, "connections": 2 }

The Docker image uses it for its built-in healthcheck, and it works as a probe target on any hosting platform.

Deploying

The image runs anywhere containers do - Railway, Fly.io, a VPS with Docker. Set SOCKSTER_ORIGIN_URL to your frontend's origin and point clients at the deployed URL; Socket.IO handles the upgrade to wss when the page is served over https. The server shuts down cleanly on SIGTERM, so rolling deploys close connections instead of dropping them.

What it isn't

There's no authentication and no persistence - every connected client sees every event, and events emitted while a client is disconnected are gone. That's the design, but it means sockster fits prototypes, local tools, and trusted environments rather than anything carrying sensitive data. It's also single-instance: there's no adapter for fanning out across multiple nodes.

Development

git clone https://github.com/djurnamn/sockster.git
cd sockster
pnpm install
pnpm test
pnpm start

Tests use Node's built-in test runner, so node >= 20 is the only requirement.

License

MIT - see LICENSE.