How To Send HTTP/2 Based Push Notification In iOS?

Post by|iOS AppMobile Apps25 January,2020
8413 View

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.

Through this blog will attempt to review the HTTP/2 API, how token-based authentication works, and a step by step approach to implement HTTP/2 based push notification for iOS Projects. So without further ado, let’s start.

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.

Token Authentication

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
  • Server

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.

Team ID:

  • Go to the membership section and get your team ID.

Bundle Identifier:

  • 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:

Wrapping Up

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.


Do I need to create a p12 certificate?

No, you do need to worry about p12 certificate creation or expirations.

Do I need to create a signing key for both development and distribution?

No, single signing key will be used for both.

Does the signing key expired after some time or not?

No, It won’t expire but you can revoke it anytime if required.

What is the maximum payload size limit? Is there any payload size difference between regular and VoIP notifications?

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.

If I upgrade from legacy API to HTTP/2 API, will it affect anything with my existing apps?

No, it won’t affect anything with your existing apps.

Speak Your Mind

  1. Sanoop KS says:

    1. I am an ios app developer, i am using firebase notification. Is HTTP/2 API a concern for me or firebase.?

    Please enter your comment.
    Please enter your name.
    • Kevin Mac says:

      No, you don’t need to worry if you have integrated firebase push notification. They will take care of it. Thanks!

      Please enter your comment.
      Please enter your name.
  2. Peter Sharbolis says:

    Kevin, A great blog post very clearly written. I am in need of converting from legacy to http/2 but the pushsharp library my developer used for the back end does not work for http/2. Any suggestions that can maintain notifications without changing the iOS app would be appreciated. I can be reached at the address below.

    Please enter your comment.
    Please enter your name.
Please enter your comment.
Please enter your name.