ostinelli / apnotic

A Ruby APNs HTTP/2 gem able to provide instant feedback.
MIT License
479 stars 94 forks source link

no not include 'aps' hash when there's only a custom_payload specified #51

Closed bzanchet closed 7 years ago

bzanchet commented 7 years ago

Hey there,

we're working on a MDM (mobile device management) solution for iOS devices and apnotic seems like the best gem for sending push notifications over http2 right now.

There was a small issue, though - MDM push notifications are of a special kind; Apple explicitly states that there shouldn't be a aps key within the push notification body (https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/MobileDeviceManagementProtocolRef/3-MDM_Protocol/MDM_Protocol.html#//apple_ref/doc/uid/TP40017387-CH3-SW3).

As luck would have it, it was easy enough to patch the library so that it doesn't send the aps key if it's empty. I'm not entirely familiar with regular push notifications - I was hoping this change doesn't break any existing behavior (in other words: are push notifications with an empty aps even valid?).

Anyways. Please let me know what you think.

Best! Bruno

ostinelli commented 7 years ago

Does this solve it for you? https://github.com/ostinelli/apnotic/pull/54

bzanchet commented 7 years ago

hi @ostinelli

yes, it does, thanks. Although I still prefer my (way) simpler solution :D

We're using my fork in production for a few months now without hiccups. I'll try and adopt the new official version and let you know how it goes, but shouldn't be a problem. It's essentially the same thing, but handling mdm as a first-class citizen other than an after thought.

Feel free to discard this PR!

ostinelli commented 7 years ago

great, thank you.