fcm-v1-http2
Send multicast notifications using HTTP/2 multiplexing through the FCM HTTP v1 API.
Supported features:
Usage
First, install the package using npm:
npm install fcm-v1-http2 --save
Then, start using the package by importing and instantiating it:
const fcmV1Http2 = require('fcm-v1-http2');
const client = new fcmV1Http2({
serviceAccount: require('./service-account.json'),
maxConcurrentConnections: 10,
maxConcurrentStreamsAllowed: 100
});
const tokens = ['ccw_syAXSNOY9ml-Kqh9wo:APA91bHAEQccW1ZpbPvsGc0LFyjEthAt_GZO7HkBGiKounM................uIDEHijb4UR5f3dhyjhO5IbiWhJAA7RVp63KSFCg384PR7nfKADReWUONEJlCnHo15WwZagVTmFcgW'];
const message = {
data: {
message: 'Hello World'
},
android: {
priority: 'high'
}
};
client.sendMulticast(message, tokens).then((unregisteredTokens) => {
console.log('Message sent successfully');
if (unregisteredTokens.length > 0) {
console.log('Unregistered device token(s): ', unregisteredTokens.join(', '));
}
}).catch((err) => {
console.error('Sending failed:', err);
});
Requirements
License
Apache 2.0