Skip to content

Instantly share code, notes, and snippets.

@kaosf
Created January 19, 2014 17:42
Show Gist options
  • Select an option

  • Save kaosf/8508289 to your computer and use it in GitHub Desktop.

Select an option

Save kaosf/8508289 to your computer and use it in GitHub Desktop.
# 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