HTTP/2

Binary frame layer

concept
  1. Data stream: a bidirectional byte stream within an established connection that can carry one or more messages.
  2. Message: A complete sequence of frames corresponding to a logical request or response message.
  3. Frame: The smallest unit of HTTP/2 communication. Each frame contains a frame header that at least identifies the data stream to which the current frame belongs.
Relationship between
  1. All communication is done over a SINGLE TCP connection, which can host any number of two-way data streams.
  2. Each data flow has a unique identifier and optional priority information for carrying two-way messages.
  3. Each message is a logical HTTP message (such as a request or response) that contains one or more frames.

4. A frame is the smallest unit of communication and carries specific types of data, such as HTTP headers, message payloads, and so on. Frames from different data streams can be sent interlaced and then reassembled according to the data stream identifier for each frame header.

Data flow priority
  1. By controlling the allocation of RESOURCES such as CPU, memory, and bandwidth, the priority of each transmission is controlled, but the sequence and priority of processing and transmission requests are not guaranteed
Multiplexing and long connections
  1. HTTP/2 connections are permanent and require only one connection per source
  2. Clients and servers can break HTTP messages into discrete frames, send them interlaced, and then reassemble them at the other end.
Server push
  1. The server can send multiple responses to a client request, that is, after the client sends a request to the server, the server can actively send messages to the client multiple times without waiting for the client to request again
The Header compression

Compress request header and response header data using the HPACK compression format

  1. Support for encoding header fields of transports through static Huffman code, reducing the size of individual transports.
  2. Both the client and server are required to maintain and update an index list of previously seen header fields, which is then used as a reference for validating the previously transmitted values.