-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InvalidServerResponse #16
Comments
I get an HTML page with a 401 Unauthorized response. Perhaps the module could detect this and re-connect? I've set keepAlive to true and it's still happening. |
I get the same problem yesterday, but reading the documentation at https://github.com/SpeCT/node-c2dm#avoiding-login-procedure is better to handle the update of auth token with: c2dm.on('token', function(err, token) { ... }); this fix for me! |
Hi, I have also this problem and I might found the reason why. Comparing the message sent before and after the Update-client-auth is received there is a difference in the token. {"host":"android.apis.google.com","port":443,"path":"/c2dm/send","method":"POST","headers":{"Host":"android.apis.google.com","Authorization":"GoogleLogin Auth=DQAAAL4AAABt92s...etc"}} And after a token update it is sent like this {"host":"android.apis.google.com","port":443,"path":"/c2dm/send","method":"POST","headers":{"Host":"android.apis.google.com","Authorization":"GoogleLogin DQAAAL0AAAB...etc"}} Second one is missing the Auth= in the GoogleLogin, so I just changed in the c2dm.js file to add 'auth=' when saving the new token and it seems to work better. Need to do some more testing though. |
antonsson could you share your changes? Just to be sure, I'm moving my first steps on JavaScript and Node.js world! |
For me as well, working on my first node js project, so I can't guarentee anything :) Here are my changes, starting at line 118. // Check if we need to update the headers and try again
var newToken = res.headers['update-client-auth'];
if (newToken) {
self.emit('token', null, "Auth="+newToken);
// Removed two lines below as the answer is still available in this response, no need to send again.
//self.send(packet, cb);
//return; // ignore any other events from this request
} So far it is working for me at least Edit: Probably the correct way is to look for the Auth and add it only if it is missing according to above |
It'd be really cool if one of the pull requests to fix this InvalidServerResponse could get merged in and pushed out to npm. It seemed to fix the errors I was getting with InvalidServerResponse. |
Hi Guys. |
Thanks for your work on this module! I have a question... I've implemented this and it seems to work fine for a while, then stops. I get an error of InvalidServerResponse. This is just for a few test devices in-house so I know the registration id's are valid.
Any idea why this might occur? I've just added a console.log statement to the respond() function where this error code is set, and will report back.
The text was updated successfully, but these errors were encountered: