V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
magicdawn
V2EX  ›  iDev

APNs 正确的姿势是啥

  •  
  •   magicdawn ·
    magicdawn · 2016-12-14 12:01:22 +08:00 · 6141 次点击
    这是一个创建于 2661 天前的主题,其中的信息可能已经有所发展或是发生改变。

    API Endpoint

    https://github.com/node-apn/node-apn/blob/v2.1.1/lib/config.js#L5-L8

    let EndpointAddress = {
      production: "api.push.apple.com",
      sandbox:    "api.sandbox.push.apple.com"
    };
    

    ping

    $ ping api.push.apple.com
    PING api.push-apple.com.akadns.net (17.188.154.155): 56 data bytes
    Request timeout for icmp_seq 0
    Request timeout for icmp_seq 1
    Request timeout for icmp_seq 2
    Request timeout for icmp_seq 3
    Request timeout for icmp_seq 4
    Request timeout for icmp_seq 5
    Request timeout for icmp_seq 6
    Request timeout for icmp_seq 7
    ^C
    --- api.push-apple.com.akadns.net ping statistics ---
    9 packets transmitted, 0 packets received, 100.0% packet loss
    
    $ ping api.sandbox.push.apple.com
    PING api.sandbox.push-apple.com.akadns.net (17.188.138.73): 56 data bytes
    Request timeout for icmp_seq 0
    Request timeout for icmp_seq 1
    Request timeout for icmp_seq 2
    Request timeout for icmp_seq 3
    Request timeout for icmp_seq 4
    Request timeout for icmp_seq 5
    Request timeout for icmp_seq 6
    Request timeout for icmp_seq 7
    ^C
    --- api.sandbox.push-apple.com.akadns.net ping statistics ---
    9 packets transmitted, 0 packets received, 100.0% packet loss
    

    辣么

    问题来了, 在天朝做 Apple Push 正确的姿势是怎样的, 给接口加代理 ?

    12 条回复    2016-12-16 15:42:28 +08:00
    current
        1
    current  
       2016-12-14 12:13:10 +08:00
    APNS 服务器禁用 ping
    GOOD21
        2
    GOOD21  
       2016-12-14 13:43:56 +08:00
    阿里云香港节点
    sallowdish
        3
    sallowdish  
       2016-12-14 17:40:38 +08:00
    不看 doc 的標準姿勢。。 Apple APNS 只有兩個 interface , either binary or HTTP/2
    hwwangwang
        4
    hwwangwang  
       2016-12-14 17:55:42 +08:00
    binary 有点蠢了, http2 才是王道。
    magicdawn
        5
    magicdawn  
    OP
       2016-12-14 21:58:26 +08:00
    @hwwangwang

    http/2 也是 binary protocol ...
    magicdawn
        6
    magicdawn  
    OP
       2016-12-14 21:59:09 +08:00
    @sallowdish

    我本机一直发送超时...于是 ping 下试试... 貌似是不允许 ping
    lokig
        7
    lokig  
       2016-12-14 23:40:12 +08:00
    http/2 可以正常用,不过如果不加代理的话,不太稳定就是了
    magicdawn
        8
    magicdawn  
    OP
       2016-12-15 11:24:11 +08:00
    @current @GOOD21 @hwwangwang @lokig @sallowdish
    各位大侠 APNs 都是什么语言写的, 使用 SDK, 还是直接对着 Apple 文档直接写呢 ?
    GOOD21
        9
    GOOD21  
       2016-12-15 11:29:41 +08:00   ❤️ 1
    java http2
    current
        10
    current  
       2016-12-15 12:11:19 +08:00   ❤️ 1
    @magicdawn python ,对着文档撸的, binary 协议
    hwwangwang
        11
    hwwangwang  
       2016-12-15 16:31:55 +08:00   ❤️ 1
    @magicdawn http2 是 json 格式的 payload ,直接 http.post 就行。
    不需要自己再写一遍之前的二进制协议了,也不用自己维护 socket 链接池,只要用稳定的 http2 client 就可以很简单的完成推送需求。
    lokig
        12
    lokig  
       2016-12-16 15:42:28 +08:00   ❤️ 1
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   954 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 21:20 · PVG 05:20 · LAX 14:20 · JFK 17:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.