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

@apinator/client

v2.0.0

Published

JavaScript client SDK for Apinator — real-time WebSocket messaging

Readme

@apinator/client

npm version License: MIT CI

JavaScript client SDK for Apinator — real-time WebSocket messaging for web applications.

Features

  • Public, private, and presence channels
  • Automatic reconnection with exponential backoff
  • Client events on private/presence channels
  • Presence member tracking
  • TypeScript-first with full type definitions
  • Zero dependencies — works in any modern browser
  • Dual ESM + CommonJS builds

Installation

npm install @apinator/client

Or via CDN:

<script src="https://cdn.jsdelivr.net/npm/@apinator/client/dist/index.mjs" type="module"></script>

Quick Start

import { Apinator } from '@apinator/client';

const client = new Apinator({
  appKey: 'your-app-key',
  cluster: 'eu',
});

client.connect();

const channel = client.subscribe('my-channel');

channel.bind('my-event', (data) => {
  console.log('Received:', data);
});

Channel Types

Public Channels

No authentication required. Any client can subscribe.

const channel = client.subscribe('news');
channel.bind('update', (data) => { /* ... */ });

Private Channels

Require server-side authentication. Prefix with private-.

const client = new Apinator({
  appKey: 'your-app-key',
  cluster: 'eu',
  authEndpoint: '/api/realtime/auth',
});

const channel = client.subscribe('private-orders');
channel.bind('new-order', (data) => { /* ... */ });

Presence Channels

Like private channels, but also track who is subscribed. Prefix with presence-.

const presence = client.subscribe('presence-chat') as PresenceChannel;

presence.bind('realtime:subscription_succeeded', () => {
  console.log('Members:', presence.getMembers());
  console.log('Me:', presence.me);
});

presence.bind('realtime:member_added', (member) => {
  console.log('Joined:', member);
});

presence.bind('realtime:member_removed', (member) => {
  console.log('Left:', member);
});

channel.me is derived from the signed channel_data returned by your authEndpoint. It becomes available only after realtime:subscription_succeeded.

Client Events

Trigger events directly from the client on private or presence channels:

const privateChannel = client.subscribe('private-chat');
privateChannel.trigger('client-typing', { user: 'alice' });

Connection States

Monitor the connection lifecycle:

client.bind('state_change', ({ previous, current }) => {
  console.log(`${previous} -> ${current}`);
});

States: initializedconnectingconnecteddisconnected / unavailable

API Reference

See docs/api-reference.md for the full API.

Browser Support

Any browser with WebSocket and fetch support:

  • Chrome 42+
  • Firefox 39+
  • Safari 10.1+
  • Edge 14+
  • Brave 10+

Links

License

MIT — see LICENSE.