Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/igor-adlab/hemera-fcm

Hemera plugin for Google FCM
https://github.com/igor-adlab/hemera-fcm

fcm firebase hemera typescript

Last synced: about 1 month ago
JSON representation

Hemera plugin for Google FCM

Awesome Lists containing this project

README

        

# Hemera FCM
Plugin for Firebase Cloud Messaging

## Examples

### Setup
```javascript
const FCM = require('hemera-fcm');
// Code...
hemera.use(FCM, { credentials: require('./google-services') });
```

### Send notification
```javascript
hemera.act({
cmd: "CMD_SEND_DEVICE" || "CMD_SEND_TOPIC" || "CMD_SEND_GROUP",
topic: "TOPIC_FCM",
id: ["id-1", "id-2", "..."],
payload: {
data: {},
notification: {
title: "...",
body: "...",
},
},
}, function() {})
```

### Subscribe / Unsubscribe to chanel
```javascript
hemera.act({
cmd: "CMD_SUBSCRIBE" || "CMD_UNSUBSCRIBE",
topic: "TOPIC_FCM",
payload: {
client: "...",
topic: "...",
},
}, function() {})
```