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

multi-gcm

v1.0.2

Published

Node.JS module to send GCM Push Notifications for Android & iOS

Readme

MultiGCM

Node.JS module to send GCM Push Notifications for both iOS & Android

#Installation

npm install -g multi-gcm

#How To Use var gcm = require('./MultiGCM'); var MultiGCM = new gcm.MultiGCM('AIza...');

var messageAndroid = new gcm.GCMMessage({
  registration_ids:['your_registration_ids'],
  type: 'device type', //Android or iOS
  data: {
    'Your own payload.'
  }
});

MultiGCM.send(message,function(err,response){
    if(err){
        console.error(err);
    }else{
        console.log(response); //Containing the custom result object of this Library
        console.log(response.result); //Containing the JSON object response from GCM
    }
});

#Message Object - Properties registration_ids(array of Strings): Array containing the GCM Tokens to send the notifications.

type: The type of devices (iOS,Android). Needed to make checks on the notification payload properties. (Some properties are required when sending to Android using notification, so it needs to be checked before sending it.)

notification(object): Notification object payload.

data(object): Data object payload.

collapse_key(string): Collapse_key, if not applicable it will not get sent.

dry_run(boolean): Dry_run, if not applicable it will not get sent.

time_to_live(number): Time_to_live, if not applicable it will not get sent.

delay_while_idle(boolean): Delay_while_idle, if not applicable it will not get sent.

priority(number): Priority, if not applicable it will not get sent.

content_available(boolean): Content_available (iOS only). Used in APNS payload to wake the client app.

restricted_package_name(string): Restricted_package_name, if not applicable it will not get sent.

For more information on the properties of notification or the message, visit: GCM Connection Server Reference

#Notification Payload - Properties body(string): Notification body text.

sound(string): By default default is only supported.

title(string): Required when sending a notification to Android devices. (Throws error if not sent, before sending).

icon(string): Required when sending a notification to Android devices. (Throws error if not sent, before sending).On Android: sets value to myicon for drawable resource myicon.png.

#Result Object - Properties code(number): Response status code.

error(string): Human readable error message. If the request was successful it will be null.

result(object): The raw GCM response body.

multicastId(string): The multicast_id of the sent Push Notification.

numOfSuccesses(number): Number of successful deliveries.

numOfFailures(number): Number of failed deliveries.

numOfCanonicalIds(number): Number of canonical ids.

errors(array of objects): Custom error objects containing the error message and the error position from the GCM result. Will be null if there are no errors.

errorPositions(array of numbers): Array containing the error positions. Will be null if there are no errors.

deletablePositions(array of numbers): Array containing positions for deletable GCM tokens, if the error received is NotRegistered. Will be null if there are no errors.

canonicalIdsPositions(array of numbers): Array containing positions of Canonical Ids, if there are any. Will be null if there are no Canonical Ids.

canonicalIds(array of strings): Array containing the Canonical Ids, if there are any. Will be null if there are no Canonical Ids.

messageIds(array of strings): Array containing the Message Ids. Useful to check things with GCM Diagnostics in Play Store.

deletableTokens(array of strings): Array containing the GCM Tokens that you can delete from your server. These GCM Tokens are either derived from Canonical Ids or errors with NotRegistered message.

Credits

Author : Pavlos-Petros Tournaris ([email protected])

Google+ : +Pavlos-Petros Tournaris

Facebook : Pavlos-Petros Tournaris

LinkedIn : Pavlos-Petros Tournaris

(In case you use this in your app let me know to make a list of apps that use it! )

License

Copyright 2015 Pavlos-Petros Tournaris

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.