Comparing version 0.9.6 to 0.9.7
@@ -69,5 +69,7 @@ /*! | ||
'MAX_BACKOFF_DELAY' : 1024000 | ||
'MAX_BACKOFF_DELAY' : 1024000 , | ||
'SOCKET_TIMEOUT' : 180000 //three minutes | ||
}; | ||
module.exports = Constants; |
@@ -13,4 +13,5 @@ /*! | ||
function Sender(key) { | ||
function Sender(key , options) { | ||
this.key = key; | ||
this.options = options ; | ||
} | ||
@@ -23,3 +24,4 @@ | ||
post_options, | ||
post_req; | ||
post_req, | ||
timeout; | ||
@@ -78,10 +80,23 @@ body[Constants.JSON_REGISTRATION_IDS] = registrationIds; | ||
var data = JSON.parse(buf); | ||
callback(null, data); | ||
} catch (e) { | ||
console.log("Error handling GCM response " + e); | ||
callback("error", null); | ||
return callback("error", null);; | ||
} | ||
callback(null, data); | ||
}); | ||
}); | ||
timeout = Constants.SOCKET_TIMEOUT; | ||
if(this.options && this.options.timeout){ | ||
timeout = this.options.timeout; | ||
} | ||
post_req.on('socket', function (socket) { | ||
socket.setTimeout(timeout); | ||
socket.on('timeout', function() { | ||
post_req.abort(); | ||
}); | ||
}); | ||
post_req.on('error', function (e) { | ||
@@ -88,0 +103,0 @@ console.log("Exception during GCM request: " + e); |
{ | ||
"name": "node-gcm", | ||
"description": "a Node.JS wrapper library-port for Google Cloud Messaging for Android", | ||
"version": "0.9.6", | ||
"version": "0.9.7", | ||
"author": "Marcus Farkas <toothlessgear@finitebox.com>", | ||
@@ -18,3 +18,5 @@ "contributors": [ | ||
{ "name": "Ismael Gorissen", "email": "ismael.gorissen@gmail.com" }, | ||
{ "name": "Joris Verbogt", "email": "joris@notifica.re" } | ||
{ "name": "Joris Verbogt", "email": "joris@notifica.re" }, | ||
{ "name": "goelvivek", "email": "goelvivek2011@gmail.com" }, | ||
{ "name": "Lars Jacob", "email": "lars@jaclar.net" } | ||
], | ||
@@ -21,0 +23,0 @@ "repository": { |
@@ -35,3 +35,3 @@ # node-gcm | ||
// Optional | ||
// OPTIONAL | ||
// add new key-value in data object | ||
@@ -55,3 +55,3 @@ message.addDataWithKeyValue('key1','message1'); | ||
message.timeToLive = 3; | ||
// END Optional | ||
// END OPTIONAL | ||
@@ -63,4 +63,4 @@ // At least one required | ||
/** | ||
* Parameters: message-literal, registrationIds-array, No. of retries, callback-function | ||
*/ | ||
* Params: message-literal, registrationIds-array, No. of retries, callback-function | ||
**/ | ||
sender.send(message, registrationIds, 4, function (err, result) { | ||
@@ -98,2 +98,4 @@ console.log(result); | ||
* [Joris Verbogt](https://github.com/silentjohnny) | ||
* [goelvivek](https://github.com/goelvivek) | ||
* [Lars Jacob](https://github.com/jaclar) | ||
@@ -126,2 +128,7 @@ ## License | ||
## Changelog | ||
**0.9.7** | ||
* move callback outside of try catch block | ||
* updated README | ||
* updated contributors | ||
**0.9.6:** | ||
@@ -128,0 +135,0 @@ * fixed undefined "data" var |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16589
266
158