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

@mifistix-cloud/realtime

v2.0.5

Published

Realtime WebSocket SDK for Mifistix Cloud - Subscribe to data changes in realtime

Readme

@mifistix-cloud/realtime

Realtime WebSocket SDK for Mifistix Cloud - Subscribe to data changes in realtime.

License

This module is licensed for internal use within Mifistix only. See LICENSE for details.

Installation

npm install @mifistix-cloud/realtime

Quick Start

const { initializeApp } = require('@mifistix-cloud/app');
const { connectRealtime, onValue, off } = require('@mifistix-cloud/realtime');

// Initialize app
const app = initializeApp({
  apiKey: 'your-api-key',
  projectId: 'your-project-id'
});

// Connect to realtime
const rt = connectRealtime(app);

// Listen for value changes
const unsubscribe = onValue(rt, 'users/user1', (snapshot) => {
  console.log('User data changed:', snapshot.val());
});

// Stop listening
off(unsubscribe);

// Disconnect
rt.disconnect();

API Reference

connectRealtime(app, customWsUrl?)

Connect to realtime WebSocket server.

Parameters:

  • app (Object, required): Initialized app instance
  • customWsUrl (string, optional): Custom WebSocket URL

Returns: Realtime client instance

Example:

const rt = connectRealtime(app, 'wss://your-ws-server.com');

onValue(rt, path, callback)

Listen for value changes at a path.

Parameters:

  • rt (Object): Realtime instance
  • path (string, required): Database path (validated)
  • callback (Function, required): Callback function receiving snapshot

Returns: Unsubscribe function

Example:

const unsubscribe = onValue(rt, 'users/user1', (snapshot) => {
  if (snapshot.exists()) {
    console.log('Current value:', snapshot.val());
  }
});

onChildAdded(rt, path, callback)

Listen for child added events (simplified implementation).

Parameters:

  • rt (Object): Realtime instance
  • path (string, required): Database path
  • callback (Function, required): Callback function

Returns: Unsubscribe function

off(unsub)

Unsubscribe from a listener.

Parameters:

  • unsub (Function): Unsubscribe function returned by onValue/onChildAdded

Realtime Client Methods

rt.disconnect()

Disconnect WebSocket and stop auto-reconnect.

Example:

rt.disconnect();

Data Snapshot

Callbacks receive a snapshot object:

snapshot.val();      // any - the data value
snapshot.exists();   // boolean - whether data exists
snapshot.key();      // string - the key

WebSocket Features

  • Auto-reconnect: Automatically reconnects on connection loss
  • Exponential backoff: Reconnect delay increases on failures
  • Queue: Messages queued while disconnected
  • Resubscribe: Automatically resubscribes on reconnect

Security Features

  • Path Validation: Validates paths before subscription
  • Callback Validation: Ensures callback is a function
  • Project Isolation: Uses project ID in WebSocket URL
  • API Key Auth: API key in WebSocket URL for authentication

Architecture

realtime/
├── src/
│   ├── core/
│   │   └── RealtimeClient.js    # Main realtime client
│   ├── services/
│   │   └── WebSocketClient.js   # WebSocket connection
│   ├── utils/
│   │   └── helpers.js          # Helper functions
│   ├── types/
│   │   └── index.js            # Type definitions
│   └── config/
│       └── constants.js        # Configuration constants
└── index.js

License

MIT