ToothlessGear / node-gcm

A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
https://github.com/ToothlessGear/node-gcm
Other
1.3k stars 206 forks source link

Added error handler to HTTPS request to handle DNS exceptions #6

Closed monkbroc closed 12 years ago

monkbroc commented 12 years ago

Hello again,

I made another small fix to handle exceptions thrown by the HTTPS request, such as failed DNS resolutions. This can happen if the internet connection is temporarily down on the server.

Without this fix, Node.js simply shuts down because of an unhandled exception.

The error handler simply logs the error and triggers the normal retry process with exponential backoff.

You can test the change by setting 'GCM_SEND_ENDPOINT' : 'android.googleapis1234.com' and sending a GCM message.

ToothlessGear commented 12 years ago

Appreciate it Thank you, again!