Created
January 19, 2014 17:42
-
-
Save kaosf/8508289 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ref. https://npmjs.org/package/gcm | |
| # How to Use | |
| # YOUR-EDITOR sender.coffee | |
| # # fill in apiKey and registration_id | |
| # npm install -g [email protected] | |
| # npm install gcm | |
| # coffee sender.coffee | |
| {GCM} = require 'gcm' | |
| apiKey = '' | |
| gcm = new GCM apiKey | |
| message = | |
| registration_id: '' | |
| collapse_key: 'Collapse key' | |
| 'data.key1': 'value1' | |
| 'data.key2': 'value2' | |
| gcm.send message, (err, messageId) -> | |
| if err | |
| console.log "Something has gone wrong!" | |
| else | |
| console.log "Sent with message ID: ", messageId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment