`
shake863
  • 浏览: 637391 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

apns批量使用失败

阅读更多

 

突然某一天app 调用 apns 用户莫名其妙收不到,由于调用的是底层的统计接口,不知道是自己的问题还是水果的

问题,好吧,自己裸调水果接口。

 

用pip 搜索了一下 python 的包,撞了 pyapns  和 apns  发现 apns 貌似比较成熟一些,还包含了feedback的

调用,试这调用发现没有问题,虽然有些延迟但是,基本上不会失败。接着底层接口的同事过来调试。我发他debug。

发现每次调用都记录下来的,好吧那就是水果没给发了,看了好多网上的文档都感觉不靠谱,还是自己去读一遍水果

的官方文档吧,的吧的吧的看了一统,发现一些有用约定

 

 

 

我看了苹果关于 push 这块的文档,有用的就是这些

 

You should also retain connections with APNs across multiple notifications. APNs may consider connections that are rapidly and repeatedly established and torn down as a denial-of-service attack. Upon error, APNs closes the connection on which the error occurred.

As a provider, you are responsible for the following aspects of push notifications:

  • You must compose the notification payload (see “The Notification Payload”).
  • You are responsible for supplying the badge number to be displayed on the application icon.
  • You should regularly connect with the feedback web server and fetch the current list of those devices that have repeatedly reported failed-delivery attempts. Then you should cease sending notifications to the devices associated with those applications. See “The Feedback Service” for more information.

 

苹果建议对多个notification 保持连接,反而对频繁的建立和断开,会被认为 dos 攻击。

 

看样子水果是让一次连接,多次发送的,那为什么我们批量发送push 会失败呢。找来3台ios设备,反复push。

最后发现,如果中间有一个非法的token,则之后的所有notification 都发送不出去。

 

这可能和水果的审核机制有关,一次连接,批量发送push,中间有非法的token,苹果就做强烈的处理,停止发送了。

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics