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

achieve_rooms

v2.0.0

Published

Simple in-memory rooms and broadcasting for WebSocket applications using ws.

Readme

achieve_rooms

achieve_rooms provides simple, in-memory rooms and broadcasting for WebSocket applications using ws. It was developed and tested with ws; compatibility with other WebSocket implementations has not been tested.

The application creates and owns the HTTP server, WebSocket server, and WebSocket connections. achieve_rooms only groups the supplied connections and broadcasts messages among them.

Install

npm install achieve achieve_rooms ws

Achieve and ws quick start

import achieve from "achieve";
import { WebSocketServer } from "ws";
import rooms from "achieve_rooms";

const server = achieve.listen(8989);
const websocketServer = new WebSocketServer({server});

websocketServer.on("connection", (ws,request) => {
  rooms.joinRoom(ws,request.url);

  ws.on("message", (data,isBinary) => {
    rooms.broadcast(ws,data,isBinary);
  });

  ws.on("close", () => {
    rooms.remove(ws);
  });
});

Connect without a room query parameter to join the default lobby:

const ws = new WebSocket("ws://localhost:8989/");

Supply a room name to join a named room:

const ws = new WebSocket("ws://localhost:8989/?room=documents");

The selected room name is stored directly on the supplied connection as ws.room. A message therefore does not need to identify its room again. Rooms are created when first used and deleted after their last connection is removed.

rooms.broadcast(ws,data,isBinary) sends to the other connections in ws.room; it does not echo the message to the sender. Passing the isBinary value supplied by the ws message event preserves text and binary message types.

API

rooms.joinRoom(ws,url)

Adds ws to the room selected by the first nonempty room query parameter in url, or to lobby when no room is supplied. Room membership is stored as ws.room.

rooms.broadcast(ws,data[,isBinary])

Sends data to every other live connection in the sender's room. The optional isBinary flag is forwarded using the ws send options.

rooms.remove(ws)

Removes a connection from its room. Removing the final connection deletes the room.

rooms.theRooms

The process-local room registry. It is a Map whose room names map to Sets of WebSocket connections.

Scope

Room state exists only in the current Node.js process. It is not persistent and is not shared among cluster workers or multiple servers. Applications that need distributed or durable room state require an external coordination or storage system.

The application remains responsible for authentication, authorization, connection lifecycle, server configuration, and choosing acceptable room names.

License

MIT