我必须使用 HTTP/2.0 来发送 Apple 推送通知吗?我可以使用 libcurl 吗? [英] Must I use HTTP/2.0 to send Apple Push Notifications? May I use libcurl?

查看:37
本文介绍了我必须使用 HTTP/2.0 来发送 Apple 推送通知吗?我可以使用 libcurl 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题,正如你从标题中推断出来的,实际上是两个问题.

This question, as you may have inferred from the title, is really two questions in one.

第一个问题:我必须使用 HTTP/2.0 发送 Apple 推送通知吗?

关于 Apple 提供的 APNs Provider API 文档,开头段落指定:

On the APNs Provider API documentation provided by Apple, the opening paragraphs specify:

提供程序 API 基于 HTTP/2 网络协议.

The provider API is based on the HTTP/2 network protocol.

在整个文档中还有其他几个对 HTTP/2.0 的引用.但是,我没有看到(并不是说它不存在)任何指定必须使用 HTTP/2.0 的内容.这是否意味着我可以使用任何 HTTP 版本?还是我实际上受限于 HTTP/2.0?

There are several other references to HTTP/2.0 throughout the documentation. However I don't see (which is not to say it's not there) anything specifying that HTTP/2.0 must be used. Does this mean that I am allowed to use any HTTP version? Or am I in fact constrained to HTTP/2.0?

我对 HTTP/1.1 非常熟悉,但我对 HTTP/2.0 几乎一无所知,因此如果我能够使用我熟悉的旧协议,我会更喜欢.

I am very familiar with HTTP/1.1 but I know almost nothing about HTTP/2.0, thus if I am able to use my old familiar protocol I would prefer that.

第二个问题(基于第一个问题):我可以将 libcurl 与 APNs 一起使用吗?

这个问题只有在第一个问题得到肯定回答的情况下才有意义.如果不是我必须将 HTTP/2.0 与 APNs 一起使用,那么我已经知道我可以使用 libcurl.

This question is only relevant given an affirmative answer to the first question. If it's not true that I must use HTTP/2.0 with APNs then I already know that I can use libcurl.

我将从一个已经很忙的服务器发送许多 APN,我更愿意在本地发送 - 因此我计划尽可能使用 libcurl.但是我知道 libcurl 在 HTTP/2.0 方面有些限制.

I will be sending many APNs from an already busy server and I would prefer to do it natively - therefore I plan to use libcurl if possible. However I understand that libcurl is somewhat limited when it comes to HTTP/2.0.

主要问题是,当 libcurl 进行 HTTP/2.0 连接时,它实际上以包含 upgrade 标头的 HTTP/1.1 请求开始,然后等待 101 Switching Protocols 状态行.APNs 支持这种行为吗?或者我必须尝试使用​​诸如 nghttp2 之类的东西?

The main problem is that when libcurl makes an HTTP/2.0 connection, it actually starts with an HTTP/1.1 request that includes an upgrade header, and then waits for a 101 Switching Protocols status line. Is this behavior supported with APNs? Or must I try to use something like nghttp2?

我发现 nghttp2 有点复杂,而且目前非常文档很少.我担心如果我不能使用 libcurl,我可能最终不得不使用套接字自己实现 HTTP/2.0(这将是最糟糕的).

I have found that nghttp2 is somewhat complex and very poorly documented at the moment. I'm worried that if I can't use libcurl I might end up having to implement HTTP/2.0 on my own using sockets (which would be THE WORST).

对于任何一个问题,我们都非常感谢您的帮助!谢谢大家!

推荐答案

好吧,我终于找到了答案.是的,HTTP/2 是使用 APNS 所必需的.

OK after a good deal of time I finally found the answer. Yes, HTTP/2 is required to use APNS.

它归结为 中的一行APNS 文档

APN 需要使用 HPACK(HTTP/2 的标头压缩),以防止重复的标头键和值.

APNs requires the use of HPACK (header compression for HTTP/2), which prevents repeated header keys and values.

这意味着 HTTP/2 是协议的必需部分.

which would imply that HTTP/2 is a required part of the protocol.

这篇关于我必须使用 HTTP/2.0 来发送 Apple 推送通知吗?我可以使用 libcurl 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆