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

@datonow/sdk

v0.1.8

Published

JavaScript/TypeScript client SDK for Datonow — real-time notification delivery via WebSocket.

Readme

@datonow/sdk

JavaScript/TypeScript client SDK for the Datonow notification platform. Real-time delivery via WebSocket with a REST fallback — zero runtime dependencies.

Installation

npm install @datonow/sdk
# or
pnpm add @datonow/sdk

Quick start: Frontend (Consumer)

import { Datonow } from '@datonow/sdk';

const client = new Datonow({
  appId:       'YOUR_APP_ID',
  publicToken: 'YOUR_PUBLIC_TOKEN',
  recipientId: 'user-123',             // the logged-in user
  endpoint:    'wss://yourdomain.com', // or ws://localhost:8080 locally
});

// Real-time
client.on('notification', (notif) => {
  console.log('New notification:', notif.title);
});

client.on('unread_count', (count) => {
  updateBadge(count);
});

// REST
const { notifications, unread_count } = await client.list({ limit: 20 });
await client.markRead(['uuid-1', 'uuid-2']);
const count = await client.unreadCount();

// Cleanup
client.disconnect();

Quick start: Backend (Producer)

import { DatonowProducer } from '@datonow/sdk';

const producer = new DatonowProducer({
  appId:       'YOUR_APP_ID',
  secretToken: 'YOUR_SECRET_TOKEN',
  endpoint:    'https://yourdomain.com', // or http://localhost:8080 locally
});

await producer.publish({
  eventType: 'order.completed',
  recipientId: 'user-123',
  title: 'Order Shipped',
  body: 'Your order #456 is on its way.',
});

Configuration

Consumer (Datonow)

| Option | Type | Default | Description | |--------|------|---------|-------------| | appId | string | required | Your Datonow application ID | | publicToken | string | required | Your application's public token | | recipientId | string | required | The user ID to subscribe for | | endpoint | string | ws://localhost:8080 | WebSocket / API base URL | | autoConnect | boolean | true | Auto-open WebSocket on construction | | initialReconnectDelay | number | 1000 | First reconnect delay (ms) | | maxReconnectDelay | number | 30000 | Maximum reconnect delay (ms) |

Producer (DatonowProducer)

| Option | Type | Default | Description | |--------|------|---------|-------------| | appId | string | required | Your Datonow application ID | | secretToken | string | required | Your application's secret token | | endpoint | string | http://localhost:8080 | API base URL |

Events

| Event | Payload | Description | |-------|---------|-------------| | notification | Notification | New notification pushed via WebSocket | | unread_count | number | Updated unread count from server | | connected | — | WebSocket connected and authenticated (fired after auth_ok) | | disconnected | CloseEvent | WebSocket closed (auto-reconnect scheduled) | | error | Error | Unrecoverable error |

Authentication

The publicToken (Consumer) is sent securely as the Sec-WebSocket-Protocol header during the connection upgrade. It never appears in the URL query string, protecting it from proxy access logs.

The secretToken (Producer) is sent as the X-Datonow-Secret-Token header for all backend REST calls.

REST API

// Paginated notification list
const result = await client.list({ limit: 20, cursor: 'last-uuid' });
// result.notifications: Notification[]
// result.next_cursor:   string | null
// result.unread_count:  number

// Mark as read
await client.markRead(['id-1', 'id-2']);

// Unread count only
const count = await client.unreadCount();

Reconnect strategy

The SDK automatically reconnects with exponential backoff:

1s → 2s → 4s → 8s → 16s → 30s (max) → 30s → …

Call client.disconnect() to stop reconnecting permanently.

Examples

| Directory | Description | |-----------|-------------| | examples/vanilla/ | Plain HTML + ES modules — no bundler needed | | examples/nextjs/ | React hook + NotificationBell component for Next.js App Router |

License

MIT