Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 11 04:55
    eladnava closed #360
  • Mar 11 04:55
    eladnava commented #360
  • Mar 11 04:51

    eladnava on master

    #360: Improve code sample for u… (compare)

  • Mar 11 04:37
    charlesrostaing opened #360
  • Jan 04 12:27
    mtrezza commented #354
  • Jan 04 09:44
    ToothlessGear commented #354
  • Jan 02 22:23
    p-kuen edited #359
  • Jan 02 22:21
    p-kuen edited #359
  • Jan 02 22:21
    p-kuen edited #359
  • Jan 02 19:08
    p-kuen opened #359
  • Nov 18 2021 02:07

    ToothlessGear on snyk-upgrade-0ad01475386a1990f816e6b025fab448

    fix: upgrade debug from 3.1.0 t… (compare)

  • Nov 18 2021 02:07

    ToothlessGear on snyk-upgrade-0ad01475386a1990f816e6b025fab448

    (compare)

  • Nov 17 2021 15:00
    mtrezza added as member
  • Nov 17 2021 14:50
    mtrezza commented #354
  • Oct 15 2021 20:08
    eladnava commented #358
  • Oct 15 2021 20:07
    eladnava closed #358
  • Oct 15 2021 20:07

    eladnava on master

    Fix #358: rectify coding mistak… (compare)

  • Oct 14 2021 15:11
    yuripaoloni opened #358
  • Sep 03 2021 08:24
    RoyDeng commented #357
  • Sep 02 2021 14:10
    eladnava commented #357
Henry Tseng
@henrytseng
Is anyone using this in production right now?
Jaime
@jaime-franco
hello :o:
this works with FCM?
Marcus Farkas
@ToothlessGear
Yes it does! see #255
@henrytseng AFAIK Instagram uses it, as does surespot, and various push libraries
Debjeet Sarkar
@debjeetsarkar
yes using it in prod
Brad Wertman
@bmwertman
Screen Shot 2016-08-31 at 5.35.30 PM.png
How does the “Server Key” of FCM fit in with the node-gcm configuration?
Does that get passed to new gcm.Sender(’SERVER_KEY’);
swemoe
@swemoe

Hello, i try this, i found error401. var gcm = require('node-gcm');
var apiKey = "AIzaSyDxxs9S8uvjiQJcvml09narkc_dIpAY1gs";
var deviceID = "ftUAFGfn8xg:APA91bGun-NEejGn30reWXK5wyidMK094AP02a3ACFcGotBiM3eeDEhSTZKI-6vs63bGKfJ4ffcBD9ZEVc2L6X1fT0jtf7YtwJtRBqO_WMByFKoASaRRYFHQyVCUmvc3nmBmx";

var service = new gcm.Sender(apiKey);
var message = new gcm.Message();
message.addData('title', 'Hello, World');
message.addData('body', 'This is a notification that will be displayed ASAP.');

service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
if(err) console.error(err);
else console.log(response);
});

Pls help me how to correct it. I m using phonegap-plugin-push in my app.
Debjeet Sarkar
@debjeetsarkar
unauthorised server api key ,sir
You need to create a new project under FCM and provode the new ones.
swemoe
@swemoe
I will try, thank you.
Daniel Beicht
@danielbeicht

Hi, I'm new to FCM and node-gcm and try to get it run. With the Example-application I get a success-response but the notification doesn't appear on my test device?
var gcm = require('node-gcm');

// Set up the sender with your GCM/FCM API key (declare this once for multiple messages)
var sender = new gcm.Sender('AAAAhziPlIg**');

// Prepare a message to be sent
var message = new gcm.Message({
data: { key1: 'nodetest' }
});

// Specify which registration IDs to deliver the message to
var regTokens = ['eFtDerXHzCE:APA91bGEnICDH6B**'];

// Actually send the message
sender.send(message, { registrationTokens: regTokens }, function (err, response) {
if (err) console.error(err);
else console.log(response);
});

When I try it via FCM Webinterface it works fine.

Response:
{ multicast_id: 472217287575,
success: 1,
failure: 0,
canonical_ids: 0,
results: [ { message_id: '0:149572594411101%a00
' } ] }
satinos
@eJ82

try sending this message instead:

const notification = new gcm.Message({
priority: 'high',
contentAvailable: true,
delayWhileIdle: false,
timeToLive: 3,
restrictedPackageName: 'your app id here ex: com.xxx.xxxxxx',
dryRun: false,
notification: {
title: 'liveScores',
icon: 'ic_launcher',
sound: 'default',
body: 'your notificaiton message here'
}
});

it should work.
notification key should not be blank I found.
Niels Abildgaard
@hypesystem

Hi all!

Today, a lot of (all?) Android devs got an email saying that by April 11, 2019 we must migrate from using the old GCM infrastructure to the new Firebase Cloud Messaging. I just wanted to let you all know that node-gcm already uses FCM and has since version 0.14.1 :-) Feel free to ask more questions here: ToothlessGear/node-gcm#317

Best,
Niels

Tarek Moubarak
@nervouscat
Hello all! I want to check how can I use async/await while sending multiple messages
Niels Abildgaard
@hypesystem
Hey! Right now the short answer is that you can't :-(
You would need to wrap the interface in a Promise to do so.
Alternatively, you could write your own wrapper:
let sendPromise = new Promise((resolve, reject) => sender.send(message, { registrationTokens: regTokens }, (error, response) => {
    if(error) {
        reject(error);
    }
    else {
        resolve(response);
    }
});
This would let you do await sendPromise.
Tarek Moubarak
@nervouscat
alright fantastic will try it now ... thank you! also will async/await e available in version 2.0.0?
Niels Abildgaard
@hypesystem
We are not even at 1.0.0. If you want to work on adding a promise API to the library, I would be happy to guide you through it :)
Tarek Moubarak
@nervouscat
Would love to! this library is very useful
Tarek Moubarak
@nervouscat
just let me know how to proceed
also the above solution worked very well for me :D
thak you!
thank*
Niels Abildgaard
@hypesystem

The first step would be figuring out which methods we need to provide promisified versions of. I am thinking that an easy interface to expose would be something like sender.promise.send, which would be the promisified version of sender.send?

To do this, you would have to create a promise object on Sender's prototype in here: https://github.com/ToothlessGear/node-gcm/blob/master/lib/sender.js and then make sure that promise has a function send which returns a promise.

Does that approach sound reasonable to you? If so, I'd love to see your code for doing this. You can make an early PR and we can discuss it further there :-)

Let me know if you need any more pointers, I'm never quite sure how much to explain :-)
Tarek Moubarak
@nervouscat
alright awesome @hypesystem will take a look!
eduardmo
@eduardmo
Hello! I am having a bit of an issue with sending the notification. The Android app receives only when the app is closed and I have no idea why. Besides that, how could I make a voip notification. You can see the code here: http://prntscr.com/ljl4wn. Thank you!
Augusto Gonzalez
@4uGuSt0o_twitter
That's not a real problem
As far as I remember you have to send in app notifications in order to send that.
Foreground notifications are not supported anymore on Android