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

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

问题描述

这个问题,正如您可能从标题中推断出的那样,实际上是两个问题.

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

第一个问题:我必须使用HTTP/2.0发送Apple Push Notifications吗?

First Question: Must I use HTTP/2.0 to send Apple Push Notifications?

Apple提供的APN提供商API文档,开头的段落指定:

提供商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与APN一起使用吗?

Second Question (predicated on first question): May I use libcurl with APNs?

仅在对第一个问题给出肯定回答的情况下,此问题才有意义.如果不是必须将HTTP/2.0与APN一起使用,那么我已经知道可以使用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状态行. APN支持此行为吗?还是我必须尝试使用​​ 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需要使用HP​​ACK(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 Push Notifications吗?我可以使用libcurl吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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