HTTP2 協(xié)議用于 iOS 推送提醒服務(wù)_第1頁
HTTP2 協(xié)議用于 iOS 推送提醒服務(wù)_第2頁
HTTP2 協(xié)議用于 iOS 推送提醒服務(wù)_第3頁
HTTP2 協(xié)議用于 iOS 推送提醒服務(wù)_第4頁
HTTP2 協(xié)議用于 iOS 推送提醒服務(wù)_第5頁
已閱讀5頁,還剩3頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、HTTP2協(xié)議用于iOS推送提醒服務(wù)(APNS)Apple has recently updated the protocol push notifications delivery service, called APNS. The newer version of this protocol is based upon HTTP/2and JSON, which signals a huge improvement compared to the older binary protocol.News HTTP/2 based APNS ProtocolServerServerAPNSAPN

2、SHTTP/2 TLS ConnectionSend Push Notification PN1200 OK PN1Send Push Notification PN2Send Push Notification PN3400 Invalid Token PN2200 OK PN3.New features and capabilities:A JSON based request response protocolAPNS will send 200 Success Response on each notification - No more guessing whether a noti

3、fication has been accepted or not.Error response is a JSON stringMessage length increased from 2048 bytes to 4096 bytesThe connection status can be checked with help of HTTP/2 PING FrameSupport for topicsUniversal Push Notification Certificate - Use the same credentials for Development and Productio

4、n譯者信息蘋果最近更新了他們的推送提醒服務(wù)協(xié)議,APNS。這個(gè)新 版本的協(xié)議基于HTTP/2和JSON,相比于舊的二進(jìn)制協(xié)議, 新的協(xié)議有了巨大改進(jìn)。新的APNS協(xié)議基于HTTP/2 :新的特性和功能:基于JSON的請(qǐng)求和響應(yīng)對(duì)于每個(gè)通知,如果成功響應(yīng),將 會(huì)返回200標(biāo)識(shí)-不用再去猜測(cè)通知是否被接收到 響應(yīng)錯(cuò)誤將會(huì)以JSON字符的形式返回消息的長(zhǎng)度從2048個(gè)字節(jié)增加到4096個(gè)字節(jié)連接狀態(tài)可以通過HTTP/2的ping框架來進(jìn)行檢查支持主題通用的推送證書-開發(fā)和生產(chǎn)使用同一個(gè)證書即可譯者信息蘋果最近推出了 APNS,更新了他們的推送提醒服務(wù)協(xié)議。這個(gè)新版本的協(xié)議基于HTTP/2和JSON,

5、相比于舊的二進(jìn) 制協(xié)議,新的協(xié)議有了巨大改進(jìn)。新的APNS協(xié)議基于HTTP/2新的特性和功能:基于json的請(qǐng)求和響應(yīng)對(duì)于每個(gè)通知,如 果成功響應(yīng),將會(huì)返回200標(biāo)示-不用再去猜測(cè)通知是否被接收到響應(yīng)錯(cuò)誤將會(huì)以json字符的形式返回消息的長(zhǎng)度從2048個(gè)字節(jié)增加到4096個(gè)字節(jié)連接狀態(tài)可以通過HTTP/2的ping框架來進(jìn)行檢查支持主題通用的推送證書-開發(fā)和生產(chǎn)使用同一個(gè)證書即可Old APNS Binary ProtocolServerServerAPNSAPNSTLS Socket ConnectionSendPush Notification PN1Send Push Notificat

6、ion PN2SendPush Notification PN3Send Push Notification PN4InvalidToken PN2DisconnectTLS Socket ConnectionResendPush Notification PN3.The old binary APNS protocol wasvery idiosyncratic. Basically, thepush delivery server had to open a socket to the APNSgateway server,and keep on writing to the socket

7、. With this old model, you wouldntreceive a response if you were successful, but if there were any errors(for example in case of an Invalid Push token) then the server sent backan error code and closed down the socket. On top of that, you had toresend all notifications that you had sent after this i

8、nvalid token.As a result, you could never be sure if your push was acceptedsuccessfully by the server. Many systems used tricks like sending aninvalid token on purpose. All of these hacks resulted inlowerperformance for the system.Apple has a feedback service, which you can call periodically to get

9、alist of invalid tokens. The main problem with this service is that youcould only call it once to get a list of invalid tokens. So, if an appis using multiple push notification providers, they are going to competein order to get the list of invalid tokens. The more invalid tokens youhave, the lower

10、your performance is, as APNS dropsconnection for any error.譯者信息舊的APNS二進(jìn)制協(xié)議舊的二進(jìn)制APNS協(xié)議有點(diǎn)奇特,一般來說,推送分發(fā)的服 務(wù)器要打開一個(gè)同APNS網(wǎng)關(guān)服務(wù)器的socket連接,并保 持這個(gè)連接。在舊的協(xié)議下,如果服務(wù)器響應(yīng)成功的話,你 將不會(huì)收到任何回應(yīng),但是如果服務(wù)器響應(yīng)失?。ɡ纾?用了一個(gè)非法的Push token),服務(wù)器將返回了一個(gè)錯(cuò)誤編 碼,并關(guān)閉這個(gè)socketo最重要的是,你必須重新發(fā)送使用 這個(gè)無效token以后發(fā)送的所有通知。因此,你可能一直不 能確定你的推送是否成功的被服務(wù)器接收。許多系統(tǒng)

11、使用這 個(gè)漏洞,故意發(fā)送一個(gè)錯(cuò)誤的token ,這些黑客行為將導(dǎo)致 系統(tǒng)性能低下。蘋果有一個(gè)名為feedback的服務(wù),我們可 以定時(shí)調(diào)用這個(gè)服務(wù)來獲取invalid tokens的列表。這個(gè)服 務(wù)你只要調(diào)用一次就可以獲得所有的invalid tokens列表。所以,如果一個(gè)應(yīng)用有許多推送通知提供商,他們將會(huì)爭(zhēng)奪 資源去輪詢查找invalid tokens列表。invalid token越多,你 系統(tǒng)性能將越低,所以APNS只要一發(fā)生錯(cuò)誤就關(guān)閉這個(gè)連 接。Some other limitations are still present. It is a complexprocess toobt

12、ain the TLS certificates. There are poorstore-and-forwardcapabilities - APNS stores only a single notification on its server ifthe device is offline. In addition, there is no upstream messaging fromthe device back to the server. Google Cloud Messaginghas all of these capabilities.There is a bit of competitionwith GCM and APNS, especiallyconsidering the fact that GCM now has added support for iOS. Lets hopefor additional APNS features in 2016譯者信息不過仍然還有一些限制。獲取TLS證書比較復(fù)雜,而且存儲(chǔ) -轉(zhuǎn)發(fā)能力弱爆了,APNS在設(shè)備下線的時(shí)候只保留一個(gè)通知, 并且設(shè)備上線之后也不會(huì)向服務(wù)器上傳信息,Google Cloud Messaging就有所有這些特性。考慮到GCM現(xiàn)在也支持iOS設(shè)備了,那么APNS和GCM 現(xiàn)在形成了競(jìng)爭(zhēng)關(guān)系。讓我

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論