Posts

Showing posts from July, 2016

iOS Push Notification with HTTP2

Setup iOS APNS with HTTP/2 Overview: There're one issue while sending iOS notification to multiple devices with old method (send by ftp write stream). Let say you send to 100 devices, ftp write work likes this: 1. connect to APNS Server 2. for each device: send notification by using device_token & payload 3. disconnect In step 2, if there're 1 invalid token (there're many reason make a token invalid: expired, wrong cert, wrong format...etc) the connection will be block without status from APNS Server, if you want to check the status, you have to wait at least 0.5s-1s and using ftp-read to read the status. It's mean you have to check status after every ftp-write and re-connect again if there're an invalid token.  So, to send to 100 devices, you need 50 seconds, that's too long. At WWDC 2015, Apple has introduce a  new notification api by using HTTP/2 This api allow you to send notification as a post request or curl and get the result