APNs 正确的姿势是啥

2016-12-14 12:01:22 +08:00
 magicdawn

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 正确的姿势是怎样的, 给接口加代理 ?

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

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

我本机一直发送超时...于是 ping 下试试... 貌似是不允许 ping
lokig
2016-12-14 23:40:12 +08:00
http/2 可以正常用,不过如果不加代理的话,不太稳定就是了
magicdawn
2016-12-15 11:24:11 +08:00
@current @GOOD21 @hwwangwang @lokig @sallowdish
各位大侠 APNs 都是什么语言写的, 使用 SDK, 还是直接对着 Apple 文档直接写呢 ?
GOOD21
2016-12-15 11:29:41 +08:00
java http2
current
2016-12-15 12:11:19 +08:00
@magicdawn python ,对着文档撸的, binary 协议
hwwangwang
2016-12-15 16:31:55 +08:00
@magicdawn http2 是 json 格式的 payload ,直接 http.post 就行。
不需要自己再写一遍之前的二进制协议了,也不用自己维护 socket 链接池,只要用稳定的 http2 client 就可以很简单的完成推送需求。
lokig
2016-12-16 15:42:28 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/327548

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX