Closed sunojvijayan closed 8 years ago
This is not an error I have seen before. How does your code look?
@sunojvijayan It's DNS related, a code snippet will help us understand the problem.
This is my code.
var gcm = require('node-gcm');
var message = new gcm.Message();
//API Server Key
var sender = new gcm.Sender('sender id here', {
'proxy': 'aaa.abcd.com.my:8080'
});
var registrationIds = [];
// Value the payload data to send...
message.addData('message', "\u270C Peace, Love \u2764 and PhoneGap \u2706!");
message.addData('title', 'Push Notification Sample');
message.addData('msgcnt', '3'); // Shows up in the notification in the status bar
message.addData('soundname', 'beep.wav'); //Sound to play upon notification receipt - put in the www folder in app
//message.collapseKey = 'demo';
//message.delayWhileIdle = true; //Default is false
message.timeToLive = 3000; // Duration in seconds to hold in GCM and retry before timing out. Default 4 weeks (2,419,200 seconds) if not specified.
// At least one reg id required
registrationIds.push('registration id of my device');
/**
* Parameters: message-literal, registrationIds-array, No. of retries, callback-function
*/
sender.send(message, registrationIds, 4, function (result) {
console.log(result);
});
console.log("Sending");
I copied it directly from the site
@sunojvijayan I'd guess that your proxy server is not working as expected:
var sender = new gcm.Sender('sender id here', {
'proxy': 'intproxy01.maybank.com.my:8080'
});
tunneling socket could not be established
most likely refers to the proxy tunnel.
We have previously had this issue #97
A PR was started but never completed #115
I have removed the proxy and now getting this error
{ [Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:80] code: 'ECONNRESET' }
Please help
Have you changed any of the code inside the node-gcm module? It should be connecting to gcm-http.googleapis.com
, not 127.0.0.1
as it does in your case.
@hypesystem @sunojvijayan maybe the http_proxy
ENV variable is set?
I am leaning towards something like that. Anything that modifies the underlying behaviour of request could result in this.
I have not modified any code inside node-gcm module
But when I searched the code it has two files cosmic.js and usage.js in which 127.0.0.1 is mentioned.
@sunojvijayan what we mean is that you may have set the http_proxy
environment variable (outside of the node script, as an OS env variable).
Try the following command (in Linux) to check if you set it by accident:
printenv http_proxy
As you can see here the phrase "127.0.0.1" does not appear anywhere inside node-gcm. You may have some other library interfering.
Oh sorry everyone proxy was enabled for npm. It works now thanks a lot everyone
But is there a way I can run this behind a proxy?
@sunojvijayan there seems to be an issue with that currently: #97
We really should solve the proxy problem -- but that's not this issue. Closing it :smile: please continue discussion about proxy use on #97.
ok thanks
Hi,
I tried working on this from my local machine with my gcm credentials but got this error.
{ [Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 8080 8080:80] code: 'ECONNRESET' }
Can anyone help please?