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

rivium-push-react-native

v0.1.6

Published

Push notification SDK for React Native with in-app messages - Firebase alternative that works everywhere

Readme

RiviumPush React Native SDK

Real-time push notifications, in-app messages, inbox, A/B testing, and more for React Native apps. No Firebase dependency.

Features

  • Push Notifications (Android & iOS)
  • In-App Messages (modal, banner, fullscreen)
  • Inbox (persistent message center with read/archive)
  • A/B Testing (experiments and variant assignment)
  • Topic Subscriptions
  • Silent Messages
  • Notification Tap Handling
  • Auto-reconnection with exponential backoff
  • TypeScript support

Installation

npm install rivium-push-react-native
# or
yarn add rivium-push-react-native

Android Setup

Add to android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

iOS Setup

cd ios && pod install

Enable in Xcode -> Signing & Capabilities:

  • Push Notifications
  • Background Modes -> Remote notifications

Quick Start

import RiviumPush from 'rivium-push-react-native';

// Initialize on app start
await RiviumPush.init({
  apiKey: 'rv_live_your_api_key',  // Get from Rivium Console
});

// Listen for messages
const unsubscribe = RiviumPush.onMessage((message) => {
  console.log('Title:', message.title);
  console.log('Body:', message.body);
  console.log('Data:', message.data);
});

// Register device
await RiviumPush.register({ userId: 'user_123' });

// Clean up when done
unsubscribe();

Configuration

await RiviumPush.init({
  apiKey: 'rv_live_...',              // Required - from Rivium Console
  notificationIcon: 'ic_notification', // Optional - Android notification icon
  usePushKit: false,                   // Optional - iOS VoIP mode for calling apps
  showServiceNotification: true,       // Optional - foreground service notification (Android)
});

Note: Connection configuration is automatically fetched from the server using your API key. No manual setup needed.

React Hook Example

import { useEffect, useState } from 'react';
import RiviumPush from 'rivium-push-react-native';

export function useRiviumPush(userId: string) {
  const [connected, setConnected] = useState(false);
  const [deviceId, setDeviceId] = useState<string | null>(null);

  useEffect(() => {
    const unsubMessage = RiviumPush.onMessage((msg) => {
      console.log('Message:', msg);
    });

    const unsubConnection = RiviumPush.onConnectionState(setConnected);
    const unsubRegistered = RiviumPush.onRegistered(setDeviceId);

    RiviumPush.register({ userId });

    return () => {
      unsubMessage();
      unsubConnection();
      unsubRegistered();
    };
  }, [userId]);

  return { connected, deviceId };
}

Callbacks

All event handlers return an unsubscribe function for proper cleanup.

// Receive push messages
const unsub = RiviumPush.onMessage((message) => {
  console.log(message.title, message.body);
  console.log('Data:', message.data);
  console.log('Silent:', message.silent);
});

// Connection status
RiviumPush.onConnectionState((connected) => {});

// Registration complete
RiviumPush.onRegistered((deviceId) => {});

// Errors
RiviumPush.onError((error) => {});

// Detailed errors with codes
RiviumPush.onDetailedError((error) => {
  console.log('Code:', error.code, 'Message:', error.message);
});

// Reconnection attempts
RiviumPush.onReconnecting((state) => {
  console.log('Attempt:', state.retryAttempt, 'Next in:', state.nextRetryMs, 'ms');
});

// Network state changes
RiviumPush.onNetworkState((state) => {
  console.log('Available:', state.isAvailable, 'Type:', state.networkType);
});

// App foreground/background
RiviumPush.onAppState((state) => {
  console.log('Foreground:', state.isInForeground);
});

// Notification tap handling
RiviumPush.onNotificationAction((event) => {
  console.log('Action:', event.actionId);
});

Notification Tap Handling

// Get the message that launched the app (from notification tap)
const message = await RiviumPush.getInitialMessage();
if (message) {
  // Navigate based on message.data
}

Topics

await RiviumPush.subscribeTopic('news');
await RiviumPush.subscribeTopic('promotions');
await RiviumPush.unsubscribeTopic('promotions');

User Management

// Set user ID after login
await RiviumPush.setUserId('user_123');

// Clear user ID on logout
await RiviumPush.clearUserId();

// Register with user ID and metadata
await RiviumPush.register({
  userId: 'user_123',
  metadata: { appVersion: '1.0.0', language: 'en' },
});

In-App Messages

// Trigger in-app messages on app open
await RiviumPush.triggerInAppOnAppOpen();

// Trigger custom event
await RiviumPush.triggerInAppEvent('purchase_complete', { amount: 29.99 });

// Listen for in-app messages
RiviumPush.onInAppMessageReady((message) => {
  console.log('In-app message:', message.name);
});

RiviumPush.onInAppButtonClick((message, button) => {
  console.log('Button clicked:', button.text);
});

// Fetch, show, dismiss
const messages = await RiviumPush.fetchInAppMessages();
await RiviumPush.showInAppMessage(messageId);
await RiviumPush.dismissInAppMessage();

Inbox

// Get inbox messages
const response = await RiviumPush.getInboxMessages({
  status: InboxMessageStatus.UNREAD,
  limit: 50,
});

// Mark as read
await RiviumPush.markInboxMessageAsRead(messageId);

// Archive
await RiviumPush.archiveInboxMessage(messageId);

// Get unread count
const count = await RiviumPush.getInboxUnreadCount();

// Mark all as read
await RiviumPush.markAllInboxMessagesAsRead();

A/B Testing

// Get active tests
const tests = await RiviumPush.getActiveABTests();

// Get variant for a test
const variant = await RiviumPush.getABTestVariant('test_id');
if (variant) {
  console.log('Variant:', variant.variantName);
  console.log('Control:', variant.isControlGroup);
}

// Track events
await RiviumPush.trackABTestImpression('test_id', 'variant_id');
await RiviumPush.trackABTestClicked('test_id', 'variant_id');

// Listen for variant assignments
RiviumPush.onABTestVariantAssigned((variant) => {
  console.log('Assigned to:', variant.variantName);
});

Log Levels

import { LogLevel } from 'rivium-push-react-native';

await RiviumPush.setLogLevel(LogLevel.DEBUG);   // Development
await RiviumPush.setLogLevel(LogLevel.ERROR);   // Production

// Available: NONE, ERROR, WARNING, INFO, DEBUG, VERBOSE

Utilities

const connected = await RiviumPush.isConnected();
const deviceId = await RiviumPush.getDeviceId();
await RiviumPush.unregister();
RiviumPush.removeAllListeners();

Example

See the example directory for a complete working app with all features demonstrated.

The Push SDK works independently without VoIP. To trigger VoIP incoming call UI, send push with data:

{
  "type": "voip_call",
  "callerName": "John Doe",
  "callerId": "user_456",
  "callerAvatar": "https://example.com/avatar.jpg",
  "callType": "video"
}

The type: "voip_call" is the system trigger (fixed). Caller data keys are configurable via VoIP SDK config.

Links

License

MIT License - see LICENSE for details.