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

@bloonio/chat-client-core

v0.1.0

Published

Framework-agnostic TypeScript core for the bloonio chat widget + SDKs. WebSocket protocol, REST client, signed-token handling, branding config types.

Readme

@bloonio/chat-client-core

Framework-agnostic TypeScript core for the bloonio chat widget and framework SDKs (Preact widget, Angular, future React/Vue). Zero runtime dependencies.

@bloonio/chat-widget       (Preact embeddable, phase 9f)
@bloonio/chat-angular      (Angular library, phase 9g)
@bloonio/chat-react        (future, phase 15)        ─── all depend on ──┐
@bloonio/chat-vue          (future)                                      │
                                                                         ▼
                                                       @bloonio/chat-client-core
                                                       (this package)

What's in here

| Module | Surface | |---|---| | client.ts | ChatClient — REST wrapper for /fetch/widget-config, /create/visitor-session, /identify/visitor | | ws.ts | WSClient — WebSocket wrapper with typed handlers, ping/pong heartbeat, exponential-backoff reconnect | | protocol.ts | TS types for every inbound/outbound frame — mirrors bloonio_chat_relay/app/modules/ws_hub/protocol.py | | config.ts | WidgetBootstrapConfig + request/response shapes for the REST endpoints | | storage.ts | TokenStorage interface + localStorage-backed default (graceful fallback to in-memory in private mode) | | errors.ts | Typed error hierarchy (BloonioChatError, …Network, …Server, …Auth, …Protocol) |

Quick start

import { ChatClient, WSClient } from '@bloonio/chat-client-core';

const client = new ChatClient({ baseUrl: 'https://chat-relay.example.com' });

// 1. Bootstrap (no session — just config so we can render the launcher)
const cfg = await client.fetchWidgetConfig({
  tenantId: '019e4ae7-...',
  widgetPublicKey: 'pk_...',
  origin: window.location.origin,
});

// 2. Create a visitor session (returns a signed JWT)
const sess = await client.createVisitorSession({
  tenantId: cfg.tenant_id,
  widgetPublicKey: 'pk_...',
  origin: window.location.origin,
});

// 3. Open the WebSocket
const ws = new WSClient(
  { baseUrl: 'https://chat-relay.example.com', visitorToken: sess.visitor_token },
  {
    onWelcome: (f) => console.log('welcome', f),
    onMessage: (f) => console.log('msg', f),
    onTyping: (f) => console.log('typing', f),
    onError: (f) => console.error('proto error', f),
  },
);
ws.connect();

// 4. Send a message
ws.send({ type: 'msg', client_msg_id: 'c1', content: 'Where is my order?' });

Build + test

npm install
npm run build       # tsup → dist/index.js (ESM) + index.cjs + index.d.ts
npm test            # vitest, no-watch
npm run typecheck   # tsc --noEmit

Design notes

  • Zero runtime deps. Production bundle is whatever you write in src/ — tsup just transpiles + emits .d.ts. Consumer bundlers tree-shake naturally.
  • No framework primitives. WSClient exposes plain callback handlers, not RxJS / signals / hooks. Each framework SDK wraps these into its idiom.
  • Protocol parity with the relay. Adding a new frame type means editing both src/protocol.ts here and bloonio_chat_relay/app/modules/ws_hub/protocol.py on the Python side — one PR per change, kept lockstep.
  • Reconnect strategy. Exponential backoff (0.5s → 1s → 2s → 4s → 8s, capped at 30s). Caps at maxReconnectAttempts (default Infinity). Manual close() suppresses reconnect; transport-level failures don't.

Related

  • bloonio_chat_relay/ — the relay this client talks to (Python, FastAPI)
  • bloonio_chat_api/docs/12_PAAS_CONVERSION_PLAN.md — full PaaS plan, this package is part of phase 9e