Socket
Socket
Sign inDemoInstall

fcm-push-legacy-http

Package Overview
Dependencies
2
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fcm-push-legacy-http

A Node.JS simple interface to Firebase Cloud Messaging (FCM) for Android and iOS


Version published
Weekly downloads
6
Maintainers
1
Install size
654 kB
Created
Weekly downloads
 

Readme

Source

fcm-push

This is a fork of (fcm-push)[https://github.com/nandarustam/fcm-push] to enable to use http instead of https to send firebase push notifications. Reason? We use the client on a server where the proxy only allows http. Outside we proxy the request again to https.

A Node.JS simple interface to Firebase Cloud Messaging (FCM) for Android and iOS

Installation

Via npm:

$ npm install fcm-push-legacy-http

Usage

var FCM = require('fcm-push-legacy-http');

var serverKey = '';
var fcm = new FCM(serverKey);

var message = {
    to: 'registration_token_or_topics', // required fill with device token or topics
    collapse_key: 'your_collapse_key', 
    data: {
        your_custom_data_key: 'your_custom_data_value'
    },
    notification: {
        title: 'Title of your push notification',
        body: 'Body of your push notification'
    }
};

//callback style
fcm.send(message, function(err, response){
    if (err) {
        console.log("Something has gone wrong!");
    } else {
        console.log("Successfully sent with response: ", response);
    }
});

//promise style
fcm.send(message)
    .then(function(response){
        console.log("Successfully sent with response: ", response);
    })
    .catch(function(err){
        console.log("Something has gone wrong!");
        console.error(err);
    })

See FCM documentation for details.

Proxy Support

Documentation by @sofayam Supply agent as extra parameter in FCM Constructor, e.g. typical cntlm case:

 var HttpsProxyAgent = require('https-proxy-agent');

 var proxyurl = 'http://127.0.0.1:3128'
 agent = new HttpsProxyAgent(proxyurl);

 var fcm = new FCM(serverKey, agent);

Credits

Written and maintained by Rasmunandar Rustam & Oscar Kurniawan Thanks to Changshin Lee for his great work on node-gcm, cloned and modified from there.

License

The MIT License

Copyright (c) 2016 Rasmunandar Rustam (nandar.rustam@gmail.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Changelog

1.1.3

  • Removing unimportant console log when cb === null
  • Adding proxy support (by @sofayam) (manually picked from his fork)

1.1.2

  • Edit ES6 syntax to standard (by @ans-4175)
  • Fixing #19 "No error on invalid to-token" bug (by @ans-4175)
  • Remove unused variables (by @ans-4175)

1.1.1

  • Remove unused dependency

1.1.0

  • Add ability to send topic (by @ans-4175)
  • Multicast, now using promise style bluebirdjs (by @misugijunz)
  • Support callback on promise (by @misugijunz)
  • Fixed NotRegistered bug (credit to Saber-Technologies solution)

1.0.7

  • Fixed calling the inherits function before declaring .prototype.send function instead of after (thanks to @dnunes)

1.0.6:

  • Fixed the length calculation for strings with special UTF-8 characters (ie. german umlauts) which caused FCM errors (by @denisu)

1.0.5:

  • Major yet silly bug fix in index.js

1.0.3:

  • README updated

1.0.1:

  • README added

1.0.0:

  • Initial release

Keywords

FAQs

Last updated on 07 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc