This post was updated on .
Hi!
We detected several issues with ttl values for APNS. When specifying a value of 3600 (1 hour) for the ttl field in the push message structure, we saw that in case of iOs devices, that were offline just a few minutes no pushes were received. For android however everything seemed fine. Looking at the code (APNsPushNotificationSender#createFutureDateBasedOnTTL) we can see that the expiry date seems to be computed incorrectly: --- return new Date(System.currentTimeMillis() + ttl); --- ttl is the time-to-live in seconds. In this case ttl should be multiplied with 1000! So this explains our symptoms. Or am i missing anything here? As a workaround we tried going with ttl=-1. However then we detected, that our ios device also didn't receive any push notifications after some short time beeing offline. We thought apns would store the push message for several weeks in that case. When the device was online we however successfully received pushes with ttl=-1. Any clue whats going on here? I think we have a bug here too! Looking at how the date is calculated in this case: --- new Date(System.currentTimeMillis() + EnhancedApnsNotification.MAXIMUM_EXPIRY * 1000L); --- and then looking at AbstractAPNSService#push() (l.62): --- new EnhancedApnsNotification(c.incrementAndGet(), (int)(expiry.getTime() / 1000), deviceToken, payload); --- The calculated time value gets negative and I guess this probably results in apns dropping the push message if it could not be delivered immediately. So with these bugs it seems that 40 minutes (GCM sender will reject > 4 weeks) is actually the max retention period for apns. Thats bad, as we require several days and weeks. Didn't anybody test this at all or have similar issues? I mean retaining messages for several hours or days seems a quite usual requirement. Or am i missing something here? p.s.: our message looks something like that: --- {"message":{"badge":1,"alert":"You have new messages","sound":"NotificationSound.aiff","user-data":{"room_id":"77bf84a5aa254da0b916bc0e7b0f1f7d","type":"message"},"apns":{"content-available":true}},"criteria":{"alias":["HGEUZTM7"]},"config":{"ttl":-1}} --- Regards, Gunther Klein |
Hi!
Did anybody have a look at this yet? I mean these are severe bugs! Regards, Gunther Klein |
Hi Gunther ! You are absolutly right, and created a ticket with critical status https://issues.jboss.org/browse/AGPUSH-1567 and the fix will be shipped in our (soon to be released) 1.1.1 release. Seb On Mon, Jan 18, 2016 at 10:28 AM, gklein <[hidden email]> wrote: Hi! _______________________________________________ Aerogear-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/aerogear-users |
Hi Sebastian!
Thanks for your answer. Please note also the other bug when sending -1 as ttl (https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/push/sender/src/main/java/org/jboss/aerogear/unifiedpush/message/sender/APNsPushNotificationSender.java#L201). I think its discussable if this represents a bug in the apns java lib or on aerogear side. Fact is however that it is severe and prevents messages from beeing persistet on apns at all. Aerogear code could workaround it very easily like that: --- instead of ---- return new Date(System.currentTimeMillis() + EnhancedApnsNotification.MAXIMUM_EXPIRY * 1000L); ---- should change to --- return new Date(EnhancedApnsNotification.MAXIMUM_EXPIRY * 1000L); --- Anything bigger than 'EnhancedApnsNotification.MAXIMUM_EXPIRY * 1000L' will result in negative values sent to apns! Regards, Gunther Klein |
Thanks, I've updated the ticket, we will fix both On Mon, Jan 18, 2016 at 12:47 PM, gklein <[hidden email]> wrote: Hi Sebastian! _______________________________________________ Aerogear-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/aerogear-users |
Free forum by Nabble | Edit this page |