Open barryloh opened 10 years ago
Hi,
Can you give your code that create this issue ?
Thanks.
var gcm = require('node-gcm-service');
var message = new gcm.Message(); message.setDataWithObject({ key1: 'GCM Push Message' }); message.setDryRun(false); message.setDelayWhileIdle(false);
var sender = new gcm.Sender(); sender.setAPIKey('apikey');
var registration_ids = ['regid1', 'regid2'];
sender.sendMessage(message.toString(), registration_ids, false, function(err, data) { if (!err) { console.log('Message sent successfully'); console.log('Result: ' + err); } else { console.log('MESSAGE NOT SENT. ERRRORRR ***'); console.log('Error: ' + err); } });
Hi,
I found the bug and correct it (2c125c1bd6a1f37f31cde0aaff67068de8b8543c). I just publish a newer version of module v0.2.8
.
Close this issue when all is good for you.
This doesn't fix the problem. Now an array <= 1000 elements will generate up 1000 requests that all fail because of the registration_ids being a string now.
I guess it should be like this:
if (registration_ids.length <= 1000)
return callback([registration_ids]);
Or maybe better:
if (registration_ids.length <= 1000) array.push(registration_ids);
Unfortunatelly this is still not fixed
Hello there,
I've tried declaring
var registration_ids = ['regid1', 'regid2'];
and
var registration_ids = 'regid1';
But it doesnt seem to work. I keep coming back to that error