Today Apple has finally released a long awaited update to APNs (Apple Push Notification Service) APIs. Despite the lack of an official announcement, this has been a long awaited improvement. (Update: Apple has now made an official announcement here)
APNs first debuted as a way to send notifications to devices in iOS 3, and has remained largely unchanged since then. APNs has always been a difficult implement and use API for many reasons, including:
Notifications must be serialized to a binary format and sent individually over a secure TCP socket.
Sockets must be opened with an Apple-provided SSL certificate.
A different certificate must be used for Development vs App Store or AdHoc applications. VoIP apps must use a different, third type, of certificate entirely.
Any errors cause the TCP socket to be closed, even if valid notifications had been sent over the connection after a single invalid one. This often happens in cases where developers might accidentally mixed push identifiers between Development and Production versions of their app.
Developers must use a separate binary TCP socket API to check for unsubscribed devices and avoid sending future notifications to them.
A very small number of generic error codes make it difficult to identify causes of issues.
Multiple simultaneous connections must be opened to archive high notification throughput.
Apple's new notification API, first announced in June 2015 at WWDC and slightly delayed from it's anticipated Summer 2015 release, is meant to resolve many of the above issues. While in our opinion it's still not as nice as Google's REST-based Cloud Messaging APIs for Android, the new HTTP/2 APNs API is a major improvement.
Here's some key features that make this new protocol better for developers:
The same push notification SSL certificate can be used to send notifications across Development, AdHoc, App Store, and VoIP apps.
Apple's new HTTP/2 "Instant Feedback" feature provides detailed error descriptions and information on unsubscribed devices over the same connection without closing it.
Compression is used to increase notification throughput and reduce the need to open simultaneous connections.
Notification payloads are increasing from 2KB to 4KB.
Along with this release, it seems that Apple is deprecating the old non-HTTP/2 APNs API, and developers should prepare for it to be eventually discontinued.
Developers who have built their own notification systems can make the switch entirely on their servers since no app-level changes are required. At OneSignal we are already starting to implement this new API for our clients.
Here's to faster, easier, and more reliable Push Notification delivery in 2016!