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.4.3 to 1.4.4

7

ChangeLog.md
## Changelog
1.4.4:
* Added a check when trying to resend notifications from cache (#138/#139)
* Don't set "aps" key if no well-known properties are present (#141)
* Fixed the notification `retryLimit` behaviour when set to 0. (#142)
* Added `batchSize` property for feedback.
1.4.3:

@@ -4,0 +11,0 @@

6

lib/connection.js

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

if(socket.busy) {
if(socket.busy && socket.cachedNotifications.length > 0) {
// A notification was in flight. It should be buffered for resending.

@@ -475,3 +475,5 @@ this.bufferNotification(socket.cachedNotifications[socket.cachedNotifications.length - 1]);

}
this.bufferNotification( { "notification": notification, "recipient": recipient, "retryLimit": notification.retryLimit } );
var retryLimit = (notification.retryLimit < 0) ? -1 : notification.retryLimit + 1;
this.bufferNotification( { "notification": notification, "recipient": recipient, "retryLimit": retryLimit } );
};

@@ -478,0 +480,0 @@

@@ -35,3 +35,4 @@ var Device = require('./device');

* @config {Function} [feedback] Deprecated ** A callback which accepts 2 parameters (timestamp, {@link Device}) or an array of (timestamp, {@link Device}) object tuples, depending on the value of batchFeedback option. See: {@link <a href="https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW3">Communicating with APS</a>.
* @config {Boolean} [batchFeedback=true] If true, the feedback callback will only be called once per connection with an array of timestamp and device token tuples.
* @config {Boolean} [batchFeedback=true] If true, the feedback callback should only be called after all tokens are received, with an array of timestamp and device token tuples.
* @config {Number} [batchSize=0] The maximum number of tokens to pass when emitting the event. After `batchSize` tokens are received the `feedback` event will be emitted.
* @config {Function} [errorCallback] Deprecated ** Callback which will capture connection errors

@@ -55,3 +56,4 @@ * @config {Number} [interval=3600] Interval to automatically connect to the Feedback service.

feedback: false, /* **Deprecated**: Use `feedback` event instead, enable feedback service, set to callback */
batchFeedback: true, /* If the feedback callback should only be called once per connection. */
batchFeedback: true, /* If the feedback callback should only be called after all tokens are received. */
batchSize: 0, /* The maximum number of tokens to pass when emitting the `feedback` event, by default pass all tokens when connection closes. */
errorCallback: false, /* error handler to catch connection exceptions */

@@ -241,2 +243,6 @@ interval: 3600 /* interval in seconds to connect to feedback service */

this.feedbackData.push({ time: time, device: device });
if (this.options.batchSize > 0 && this.options.batchSize <= this.feedbackData.length) {
this.emit('feedback', this.feedbackData);
this.feedbackData = [];
}
}

@@ -266,3 +272,3 @@ this.readBuffer = this.readBuffer.slice(6 + tokenLength);

if (this.options.batchFeedback) {
if (this.options.batchFeedback && this.feedbackData.length > 0) {
debug("Emitting all feedback tokens");

@@ -269,0 +275,0 @@ this.emit('feedback', this.feedbackData);

@@ -355,21 +355,32 @@ /**

}
var apsSet = true;
if (this.payload.aps === undefined) {
this.payload.aps = {};
apsSet = false;
}
if (typeof this.badge == 'number') {
this.payload.aps.badge = this.badge;
apsSet = true;
}
if (typeof this.sound == 'string') {
this.payload.aps.sound = this.sound;
apsSet = true;
}
if (typeof this.alert == 'string' || typeof this.alert == 'object') {
this.payload.aps.alert = this.alert;
apsSet = true;
}
if (this.newsstandAvailable || this.contentAvailable) {
this.payload.aps['content-available'] = 1;
apsSet = true;
}
if (Array.isArray(this.urlArgs)) {
this.payload.aps['url-args'] = this.urlArgs;
apsSet = true;
}
if (!apsSet) {
delete this.payload.aps;
}
return this.payload;

@@ -376,0 +387,0 @@ };

{
"name": "apn",
"description": "An interface to the Apple Push Notification service for Node.js",
"version": "1.4.3",
"version": "1.4.4",
"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