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/messaging

v2.0.5

Published

Push Notifications SDK for Mifistix Cloud - Send and manage push notifications

Downloads

483

Readme

@mifistix-cloud/messaging

Push Notifications SDK for Mifistix Cloud - Send and manage push notifications.

License

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

Installation

npm install @mifistix-cloud/messaging

Quick Start

const { initializeApp } = require('@mifistix-cloud/app');
const { getMessaging, getToken, sendMessage } = require('@mifistix-cloud/messaging');

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

// Get messaging instance
const messaging = getMessaging(app);

// Get device token
const token = await getToken(messaging);

// Send push notification
await sendMessage(messaging, {
  token: 'device-token',
  title: 'New Message',
  body: 'You have a new message!',
  data: { messageId: '123' }
});

API Reference

getMessaging(app)

Get messaging instance.

Parameters:

  • app (Object, required): Initialized app instance

Returns: Messaging service instance

getToken(messaging, options?)

Get FCM token for the current device.

Parameters:

  • messaging (Object): Messaging instance
  • options (Object, optional)
    • vapidKey (string): VAPID key for web push

Returns: Promise - Device token

Example:

const token = await getToken(messaging);
console.log('Device token:', token);

sendMessage(messaging, payload)

Send push notification to a device.

Parameters:

  • messaging (Object): Messaging instance
  • payload (Object, required)
    • token (string, required): Device token (validated)
    • title (string, required): Notification title (validated)
    • body (string, required): Notification body (validated)
    • data (Object, optional): Additional data payload

Returns: Promise with result object

Example:

await sendMessage(messaging, {
  token: 'device-token-123',
  title: 'Hello World',
  body: 'This is a test notification',
  data: { clickAction: 'open_app' }
});

deleteToken(messaging, token)

Delete a device token.

Parameters:

  • messaging (Object): Messaging instance
  • token (string, required): Token to delete (validated)

Returns: Promise

Example:

await deleteToken(messaging, 'device-token-123');

onMessage(messaging, callback)

Listen for incoming messages (polling mode).

Parameters:

  • messaging (Object): Messaging instance
  • callback (Function): Callback function

Returns: Unsubscribe function

Note: This uses polling mode. For production, use WebSocket server.

Security Features

  • Token Validation: Validates device token before operations
  • Content Validation: Validates title and body are non-empty strings
  • Project Isolation: Uses project ID in all requests
  • Error Handling: Throws appropriate error types

Device Info

The SDK automatically includes device information when registering tokens:

  • Platform (navigator.platform or 'node')
  • User Agent (navigator.userAgent or 'node')

Architecture

messaging/
├── src/
│   ├── core/
│   │   └── MessagingClient.js   # Main messaging client
│   ├── services/
│   │   └── MessagingService.js  # Push notification service
│   ├── utils/
│   │   └── helpers.js          # Helper functions
│   ├── types/
│   │   └── index.js            # Type definitions
│   └── config/
│       └── constants.js        # Configuration constants
└── index.js

License

MIT