HTTP/2 for Web Application Developers, Example with NGINX

HTTP2 protocol is replacement of HTTP1.1 protocol, Its based on SPDY, HTTP/2 is more efficient, more secure and faster data transfer in applications.

HTTP/2 keep possession of the same as HTTP/1.1. Also includes HTTP methods such as 404 (page not found),URLs, Header fields, GET and POST are defined.

Added few key features in HTTP/2:

1) Single, Persistent Connection :

Only one connection is used for each web page then taken same connection is used as long as the web page is open
To share Send requests and reponses in same connection. Mainly there are three types of benefits in HTTP/2 Messages, Streams and Frames.

Messages : Send request and response in one connectionStreams : A call and response way that Transferring messages in two directions simultaneously. Need many streams for a connection.Frames : Each frame has a Header, its used to identifies for message and stream.

2) Multiplexing :

Requests and responses as being very most important and multiplexed onto separate streams within the single connection. All the request are allowed in the HTML page with dependencies and priorities.

HTTP/2 Creating and closing single connection only but the HTTP/1.1 is creates six to eight, or many more if domain sharding is in use.

HTTP/2 to making a all request together with multiplexing and give most important for response with high priority resource.

Sending the header data very less because it's compressed.

3) Header Compression and Binary Encoding:

In HTTP/1.1 header data is sent as plain text and data wasted because of bytes being sent back and forward in the HTTP headers.
In HTTP/2 headers can be compressed using the new HPACK compression algorithm. It help which is reduces the data crossing over the network, Header can sent in binary format, compact not as plain text.

4) Prioritization:

Already discussed about having a single multiplexed connection means request and response are good performance. HTTP/2 streams have a prioritization weight so that the interger values is between lowest priority is 1 to highest priority is 256. This scheme is mainly used to analysis the orders are which files are requested and check which the server retrieves that data.

Given higher priority for CSS and JavaScript files than the image files.

5) SSL Encryption:

SSL encryption is very secure the data for transfer, HTTP/2 accepting connections through TLS requires the “Application-Layer Protocol Negotiation” (ALPN) TLS extension support is available only since OpenSSL version 1.0.2.

By default SSL does not require that for HTTP/2 specification, current browsers can do and support. So enable the SSL in your website.For example have simple NGINX configuration,