Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apn

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apn - npm Package Compare versions

Comparing version 1.3.5 to 1.3.6

doc/apn.markdown.orig

5

ChangeLog.md
## Changelog
1.3.6:
* Resend notification if an error occurs before the socket drains (issue #100)
* Perform more error checking on device tokens. (issue #90)
1.3.5:

@@ -4,0 +9,0 @@

58

lib/connection.js

@@ -293,3 +293,3 @@ var Errors = require('./errors');

debug("Socket error occurred", socket.socketId, err);
if(socket.transmissionErrorOccurred && err.code == 'EPIPE') {

@@ -307,2 +307,8 @@ debug("EPIPE occurred after a transmission error which we can ignore");

}
if(socket.busy) {
// A notification was in flight. It should be buffered for resending.
this.bufferNotification(socket.cachedNotifications[socket.cachedNotifications.length - 1]);
}
this.destroyConnection(socket);

@@ -405,2 +411,33 @@ };

*/
Connection.prototype.prepareNotification = function (notification, device) {
var recipient = device;
// If a device token hasn't been given then we should raise an error.
if (recipient === undefined) {
process.nextTick(function () {
this.raiseError(Errors['missingDeviceToken'], notification);
this.emit('transmissionError', Errors['missingDeviceToken'], notification);
}.bind(this));
return;
}
// If we have been passed a token instead of a `Device` then we should convert.
if (!(recipient instanceof Device)) {
try {
recipient = new Device(recipient);
}
catch (e) {
// If an exception has been thrown it's down to an invalid token.
process.nextTick(function () {
this.raiseError(Errors['invalidToken'], notification, device);
this.emit('transmissionError', Errors['invalidToken'], notification, device);
}.bind(this));
return;
}
}
this.bufferNotification( { "notification": notification, "recipient": recipient } );
};
/**
* @private
*/
Connection.prototype.cacheNotification = function (socket, notification) {

@@ -576,22 +613,7 @@ socket.cachedNotifications.push(notification);

for (var i = recipient.length - 1; i >= 0; i--) {
var device = recipient[i];
if (!(device instanceof Device)) {
device = new Device(device);
}
this.bufferNotification({ "notification": notification, "recipient": device });
this.prepareNotification(notification, recipient[i]);
}
}
else {
if (recipient === undefined) {
process.nextTick(function () {
this.raiseError(Errors['missingDeviceToken'], notification);
this.emit('transmissionError', Errors['missingDeviceToken'], notification);
}.bind(this));
return Errors['missingDeviceToken'];
}
var device = recipient;
if (!(device instanceof Device)) {
device = new Device(device);
}
this.bufferNotification({"notification":notification, "recipient":device });
this.prepareNotification(notification, recipient);
}

@@ -598,0 +620,0 @@

@@ -19,3 +19,3 @@ /**

else {
return null;
throw new Error('Invalid Token Specified, must be a Buffer or valid hex String');
}

@@ -22,0 +22,0 @@ }

{
"name": "apn",
"description": "An interface to the Apple Push Notification service for Node.js",
"version": "1.3.5",
"version": "1.3.6",
"author": "Andrew Naylor <argon@mkbot.net>",

@@ -6,0 +6,0 @@ "contributors": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc