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

@iamqc/cc-communication

v1.1.0

Published

WebSocket integration tools for cc-session and cc-json-parser

Readme

CC WebSocket — WebSocket integration tools

Provides WebSocket communication between cc-session / cc-json-parser and frontend clients.

Project structure

src/
├── websocket-bridge.ts   # CCWebSocket (public API: start, stop, send, sendToClient)
├── websocket-server.ts   # IWebSocketServer interface + BunServerAdapter
├── client-registry.ts    # IClientRegistry interface + ClientRegistry
├── message-codec.ts      # IMessageCodec interface + MessageCodec
└── test/
    ├── usage-example.ts  # Usage examples
    └── test-client.html  # Browser test client

Architecture

CCWebSocket          ← public API
  ├── BunServerAdapter     (transport — Bun.serve)
  ├── ClientRegistry       (client state)
  └── MessageCodec         (JSON wire protocol)

Each module implements a focused interface — swappable without touching the rest.

Install

bun add cc-communication

Quick start

import { CCWebSocket } from 'cc-communication';

const ws = new CCWebSocket({ port: 3001 });

ws.setHandlers({
  onClientConnect: (clientId) => console.log('connected', clientId),
  onCustomMessage: (type, data, clientId) => {
    if (type === 'chat') {
      ws.sendToClient(clientId, { reply: `got: ${data.message}` }, 'chat_reply');
    }
  },
});

await ws.start();

// Broadcast to all clients
ws.send({ event: 'session_update' }, 'session');

API

CCWebSocket

| Method | Description | |--------|-------------| | start() | Start WebSocket server | | stop() | Stop server and close all connections | | send(data, type?) | Broadcast to all connected clients | | sendToClient(clientId, data, type?) | Send to a specific client | | getStatus() | Returns { isRunning, connectedClients, port, host } | | setHandlers(handlers) | Update event handlers |

Event handlers

ws.setHandlers({
  onClientConnect: (clientId) => {},
  onClientDisconnect: (clientId) => {},
  onMessage: (message) => {},       // all inbound messages
  onCustomMessage: (type, data, clientId) => {}, // by type
});

Client message shape

{
  type: string;
  data: any;
  timestamp: number;
  clientId: string;
}

Built-in protocol

| Inbound type | Server response | |-------------|-----------------| | ping | auto-replies pong | | invalid JSON | replies error |

Module interfaces

These are exported for testing and alternative adapters:

  • IWebSocketServerstart(), stop(), isRunning — transport seam
  • IClientRegistryadd(), remove(), get(), isConnected(), broadcast() — client state seam
  • IMessageCodecencode(), decode(), encodeConnected(), encodePong(), encodeError() — protocol seam

Test

bun run example          # start server
# Open src/test/test-client.html in browser