All Projects → MatthieuLemoine → Push Receiver

MatthieuLemoine / Push Receiver

Licence: mit
A library to subscribe to GCM/FCM and receive notifications within a node process.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Push Receiver

Electron Push Receiver
A module to bring Web Push support to Electron allowing it to receive notifications from Firebase Cloud Messaging (FCM).
Stars: ✭ 158 (+26.4%)
Mutual labels:  notifications, push-notifications, firebase-cloud-messaging, fcm
andpush
Android Push Notification in Ruby: The fastest client for FCM (Firebase Cloud Messaging)
Stars: ✭ 83 (-33.6%)
Mutual labels:  notifications, push-notifications, fcm, firebase-cloud-messaging
Rpush
The push notification service for Ruby.
Stars: ✭ 1,886 (+1408.8%)
Mutual labels:  notifications, firebase-cloud-messaging, fcm
fcm
Golang client library for Firebase Cloud Messaging.
Stars: ✭ 22 (-82.4%)
Mutual labels:  push-notifications, fcm, firebase-cloud-messaging
fcmpush
Firebase Cloud Messaging API wrapper for Ruby, suppot HTTP v1 API including access_token auto refresh feature.
Stars: ✭ 44 (-64.8%)
Mutual labels:  push-notifications, fcm, firebase-cloud-messaging
FCMBundle
A Bundle for Symfony projects to send notifications in mobile devices through Firebase Cloud Messaging API
Stars: ✭ 43 (-65.6%)
Mutual labels:  notifications, fcm, firebase-cloud-messaging
Net Core Push Notifications
Lightweight .NET Core Push Notifications for Android and iOS
Stars: ✭ 105 (-16%)
Mutual labels:  notifications, push-notifications, fcm
Node Gcm
A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
Stars: ✭ 1,286 (+928.8%)
Mutual labels:  notifications, push-notifications, firebase-cloud-messaging
Fcm Django
FCM Django: Send push notifications via django to websites, iOS & android mobile devices through FCM (Firebase Cloud Messaging)
Stars: ✭ 495 (+296%)
Mutual labels:  push-notifications, firebase-cloud-messaging, fcm
laravel-firebase
Laravel FCM (Firebase Cloud Messaging) Notification Channel
Stars: ✭ 25 (-80%)
Mutual labels:  notifications, fcm, firebase-cloud-messaging
Applozic Android Sdk
Android Real Time Chat & Messaging SDK
Stars: ✭ 611 (+388.8%)
Mutual labels:  notifications, firebase-cloud-messaging, fcm
Easynotifylibproject
Send firebase notifications to your users very easily: A new Android Lib
Stars: ✭ 31 (-75.2%)
Mutual labels:  notifications, push-notifications, fcm
Onesignal Gradle Plugin
Use with OneSignal-Android-SDK to help integrate it into your Android Studio or Gradle project. https://onesignal.com
Stars: ✭ 49 (-60.8%)
Mutual labels:  notifications, fcm
Pushkit
All the required components to set up independent web push notifications 🎈
Stars: ✭ 45 (-64%)
Mutual labels:  notifications, push-notifications
Notificationpusher
Standalone PHP library for easy devices notifications push.
Stars: ✭ 1,143 (+814.4%)
Mutual labels:  notifications, push-notifications
Pushraven
A simple Java library to interface with Firebase Cloud Messaging (FCM) API. Pushraven allows you to push notifications to clients in very few lines of code.
Stars: ✭ 67 (-46.4%)
Mutual labels:  firebase-cloud-messaging, fcm
Kotlin Firebase Group Chat
Group and OneonOne chat using firebase built in Kotlin similar to whatsapp.
Stars: ✭ 44 (-64.8%)
Mutual labels:  firebase-cloud-messaging, fcm
Push.js
The world's most versatile desktop notifications framework 🌎
Stars: ✭ 8,536 (+6728.8%)
Mutual labels:  notifications, push-notifications
Twittnuker
Android 4.0+ Twitter Client
Stars: ✭ 117 (-6.4%)
Mutual labels:  notifications, push-notifications
Uniqush Push
Uniqush is a free and open source software system which provides a unified push service for server side notification to apps on mobile devices.
Stars: ✭ 1,238 (+890.4%)
Mutual labels:  push-notifications, fcm

push-receiver

A library to subscribe to GCM/FCM and receive notifications within a node process.

For Electron, you can use electron-push-receiver instead which provides a convenient wrapper.

See this blog post for more details.

When should I use push-receiver ?

  • I want to receive push notifications sent using Firebase Cloud Messaging in an electron desktop application.
  • I want to communicate with a node process/server using Firebase Cloud Messaging infrastructure.

When should I not use push-receiver ?

  • I want to send push notifications (use the firebase SDK instead)
  • My application is running on a FCM supported platform (Android, iOS, Web).

Install

npm i -S push-receiver

Requirements

  • Node v8 (async/await support)
  • Firebase sender id to receive notification
  • Firebase serverKey to send notification (optional)

Usage

Electron

You can use electron-push-receiver instead which provides a convenient wrapper.

Node

const { register, listen } = require('push-receiver');

// First time
// Register to GCM and FCM
const credentials = await register(senderId); // You should call register only once and then store the credentials somewhere
storeCredentials(credentials) // Store credentials to use it later
const fcmToken = credentials.fcm.token; // Token to use to send notifications
sendTokenToBackendOrWhatever(fcmToken);


// Next times
const credentials = getSavedCredentials() // get your saved credentials from somewhere (file, db, etc...)
// persistentIds is the list of notification ids received to avoid receiving all already received notifications on start.
const persistentIds = getPersistentIds() || [] // get all previous persistentIds from somewhere (file, db, etc...)
await listen({ ...credentials, persistentIds}, onNotification);

// Called on new notification
function onNotification({ notification, persistentId }) {
  // Update list of persistentId in file/db/...
  updatePersistentIds([...persistentIds, persistentId]);
  // Do someting with the notification
  display(notification)
}

Test notification

To test, you can use the send script provided in this repo, you need to pass your serverKey and the FCM token as arguments :

node scripts/send --serverKey="<FIREBASE_SERVER_KEY>" --token="<FIREBASE_TOKEN>"
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].