Since it’s advent, IOS has remained the talk of the town. It is an operating system developed by Apple Inc. and has been a fierce competitor to Android ever-since. There has been a recent development in its recent version, i.e., IOS 9. It has introduced HTTP/2-Based Provider API is based on the HTTP/2 network protocol and allows app developers to send remote notifications to their app on iOS, tvOS, and OS X devices, and to Apple Watch via iOS. As you might be aware that Apple will no longer support the legacy binary protocol as of 31st March 2021. Have you started using HTTP/2-based APNs provider API? If you are not using it already, then it’s time to upgrade as soon as possible.
Review of the HTTP/2 API
HTTP/2 is a binary protocol that supports multiple streams. Furthermore, it is extremely faster as compared to certificate-based communication. It supports providing instant feedback to indicate which device tokens are no longer available. You can send larger payloads up to four kilobytes. In addition, Apple also eliminates the overhead associated with certificate handling.
Apple introduced a brand new way of authenticating against the Apple Push Notification Server (APNS) called Token Authentication. It is a way of using provider tokens instead of client certificates when sending notifications. The tokens are easy to generate programmatically, so there’s no need to worry about renewing expiring certificates. There are a number of libraries widely available for different programming languages to generate these tokens.
How Token Authentication works
Now, before getting into the details of how it works, let’s first recap how certificate authentication will work. You need to provide a client certificate from your developer account. While connecting to APNS, your server sends this certificate while handshaking and it validates the certificate and establishes a secure connection between your server and APNS. Any pushes you send on this connection are identified by the client certificate
When using token authentication, you should opt-in token signing key from the developer account. Your server will then establish a connection without a client certificate. However, before sending notifications on this connection, your server will construct an authentication token that includes your team ID. And then sign it using the private key. Now, it is possible to send notifications on this connection. Now, you have a clear idea about its terminology. Let me walk you through the steps to implement it.
Details required to implement HTTP/2 based push notification
- Signing Key(P8 Certificate)
- Private Key ID
- Team ID
- Bundle Identifier
Let’s take a look at how to generate a signing Key. Login into your apple developer account. Go to the certificates, identities and profile section in the account.
Get Signing Key and Private Key ID:
- Go to the Keys section.
- Click on create a key.
- Provide a key name. Enable Apple Push Notification Service. Click continue.
- Click Register.
- You will get a Private Key ID. Also, click on download to get the p8 certificate.
- Go to the membership section and get your team ID.
- Go to the identifier section. Get your bundle id from the list of IDs.
Http/2 protocol requires .Net core 2.2 or higher & windows server 2016 or higher, Apache HTTP 2.4.17 or higher, Nginx 1.9.5 or higher.
Send all these details to your backend team and it will be used to generate a token. If you need a tool to test the push notifications then this is a very handy tool that works with token and certificate. You can also test notifications on android as well. Here is the GitHub link: https://github.com/onmyway133/PushNotifications
We hope that our attempt to impart information about HTTP/2 has helped you in some way. You can always contact ZealousWeb for more information and technical know-how on this subject. We strongly recommend you to use it in your projects as soon as possible. It will not only save your time but also boost your efforts in the right direction. If you are hesitant on how to use it or confused on how to implement the same on the server-side, click on this tutorial link, it has all that any iOS app developers needs: For any further query, feel free to drop a line, we would be happy to assist you in all possible ways.
No, you do need to worry about p12 certificate creation or expirations.
No, single signing key will be used for both.
No, It won’t expire but you can revoke it anytime if required.
If you’re using HTTP/2 based notifications then Apple has extended the payload size from 2KB to 4KB. For VoIP notifications it is 5KB.
No, it won’t affect anything with your existing apps.