Golang APNs upgrade to HTTP2

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Record the Golang upgrade APNs, and use HTTP2 to replace the detailed procedures for http1.1.

APNs the benefits of using HTTP2 no longer need to say, a search on the internet a bunch of information. Apple's APNS push supported the HTTP2 protocol in August 2015, and the new deal was more humane, with HTTP2-based speed.

Next, list the steps for the upgrade.

1. For the Golang version, the Golang needs to be upgraded to more than 1.5. The latest stable version is 1.6.2, so I upgraded directly to 1.6.2.

Note that golang1.6 has requirements for the system, otherwise the source code compilation will not pass:

Refer:https://golang.org/doc/install

given that the current Golang version of the work is 1.1.2, older, its upgraded to 1.6.2 needs to be upgraded to 1 first.4. Since the version after 1.4, the compilation is based on Golang, not GCC. 1Download the golang1.4 package and unzip it to/usr/local (this will be before the old go backup,1the. 4 directory uses go1.4, because this is temporary). Of course, this installation path random choice, is usually this path. 2) Compile the source code. Enter the GO1.4/SRC, execute.All.bash, wait ...3Unzip the go1.6 package and unzip it to/usr/Local, the directory name is directly go4Configure the GOROOT_BOOTSTRAP environment variable, and point to the go1.4 directory export Goroot_bootstrap=/usr/local/go1.4because this is temporary, it is specified directly in the session. 5Enter go1.6 for source compilation CD/usr/local/go/src./All.bash6After compiling the pass, set the environment variable in the/etc/The profile is appended (estimated to have this goroot, without this added) export Goroot=/usr/local/Gopath= $PATH: $GOROOT/bin/then save exit source/etc/profile

7) Go version look at the revision number

2. Download the necessary third-party package, use go get failed, go to other places manually download it, because the foreign site, in the Celestial Kingdom is the wall. Recommended go to Https://gopm.io/download

You must download the following third-party package: golang.org/x/cryptogolang.org/x/net/http2golang.org/x/  Text extracts these packages to your Gopath working directory. After extracting the directory as follows Src├──github.com ... ├──golang.org│   └──x│        ├──crypto│        ├──net│        └──text after go get golang.org/x/net/http2 go get golang.org/x/cryptogo get golang.org/x/text

To this end, you can use HTTP2 for development in Golang.

Problems encountered

1. APNs's request returns an error, malformed HTTP status code "client"

This error is due to the use of http1.1 protocol to request, and APNs is using the HTTP2 protocol. Perhaps the reason is that you have not successfully used HTTP2.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.