好文档就是一把金锄头!
欢迎来到金锄头文库![会员中心]
电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

HTTP2 协议用于 iOS 推送提醒服务.docx

8页
  • 卖家[上传人]:人***
  • 文档编号:381936701
  • 上传时间:2023-07-30
  • 文档格式:DOCX
  • 文档大小:9.91KB
  • / 8 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • HTTP2协议用于iOS推送提醒服务(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 ProtocolServerServerAPNSAPNSHTTP/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 notification 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 Production译者信息苹果最近更新了他们的推送提醒服务协议,APNS。

      这个新 版本的协议基于HTTP/2和JSON,相比于旧的二进制协议, 新的协议有了巨大改进新的APNS协议基于HTTP/2 :新的特性和功能:基于JSON的请求和响应对于每个通知,如果成功响应,将 会返回200标识-不用再去猜测通知是否被接收到 响应错误将会以JSON字符的形式返回消息的长度从2048个字节增加到4096个字节连接状态可以通过HTTP/2的ping框架来进行检查支持主题通用的推送证书-开发和生产使用同一个证书即可译者信息苹果最近推出了 APNS,更新了他们的推送提醒服务协议这个新版本的协议基于HTTP/2和JSON,相比于旧的二进 制协议,新的协议有了巨大改进新的APNS协议基于HTTP/2新的特性和功能:基于json的请求和响应对于每个通知,如 果成功响应,将会返回200标示-不用再去猜测通知是否被接收到响应错误将会以json字符的形式返回消息的长度从2048个字节增加到4096个字节连接状态可以通过HTTP/2的ping框架来进行检查支持主题通用的推送证书-开发和生产使用同一个证书即可Old APNS Binary ProtocolServerServerAPNSAPNSTLS Socket ConnectionSendPush Notification PN1Send Push Notification 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. With this old model, you wouldn’treceive 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 invalid 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 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 your performance is, as APNS dropsconnection for any error.译者信息旧的APNS二进制协议旧的二进制APNS协议有点奇特,一般来说,推送分发的服 务器要打开一个同APNS网关服务器的socket连接,并保 持这个连接。

      在旧的协议下,如果服务器响应成功的话,你 将不会收到任何回应,但是如果服务器响应失败(例如,使 用了一个非法的Push token),服务器将返回了一个错误编 码,并关闭这个socketo最重要的是,你必须重新发送使用 这个无效token以后发送的所有通知因此,你可能一直不 能确定你的推送是否成功的被服务器接收许多系统使用这 个漏洞,故意发送一个错误的token ,这些黑客行为将导致 系统性能低下苹果有一个名为"feedback"的服务,我们可 以定时调用这个服务来获取invalid tokens的列表这个服 务你只要调用一次就可以获得所有的invalid tokens列表所以,如果一个应用有许多推送通知提供商,他们将会争夺 资源去轮询查找invalid tokens列表invalid token越多,你 系统性能将越低,所以APNS只要一发生错误就关闭这个连 接Some other limitations are still present. It is a complexprocess toobtain 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. Let's hopefor additional APNS features in 2016译者信息不过仍然还有一些限制。

      获取TLS证书比较复杂,而且存储 -转发能力弱爆了,APNS在设备下线的时候只保留一个通知, 并且设备上线之后也不会向服务器上传信息,Google Cloud Messaging就有所有这些特性考虑到GCM现在也支持iOS设备了,那么APNS和GCM 现在形成了竞争关系让我共同期待APNS在2016年的新 功能吧译者信息新的协议还是存在一些限制要想获取TLS证书相当复杂, 并且在存储-转发能力上也比较弱(在设备下线时,APNS仅 保留最后一条通知,而且当设备上线后,之前丢失的信息也 无法继续发送X Google Cloud Messaging就不会有这些问 题考虑到现在GCM也开始支持iOS,与APNS形成了竞争关 系让我们期待在2016年APNS会有更多新的特性吧。

      点击阅读更多内容
      关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
      手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
      ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.