Question

I am using node-gcm to send push notifications to android. Whenever node runs behind a proxy, the gcm doesn't work anymore. How can I tell gcm to use the proxy?

var sender = new gcm.Sender('XXX');
var registrationIds = [];
registrationsIds.push('YYY');
message.addDataWithObject({
    message: 'New message! Tap to reply.',
    title: "Mew Message"
});
sender.send(message, registrationIds, 4, function (err, resultmsg) {
        console.log(resultmsg);
        ...
});

Thanks & Best, Marc

Was it helpful?

Solution

After checking the lib I found a solution:

var sender = new gcm.Sender('XXX',{'proxy':'http://user:password@proxyserver:port'});

Where 'XXX' is your id and the second parameter an options-object.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top