HTTP/2
Binary frame layer
concept
- Data stream: a bidirectional byte stream within an established connection that can carry one or more messages.
- Message: A complete sequence of frames corresponding to a logical request or response message.
- 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
- All communication is done over a SINGLE TCP connection, which can host any number of two-way data streams.
- Each data flow has a unique identifier and optional priority information for carrying two-way messages.
- 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
- 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
- HTTP/2 connections are permanent and require only one connection per source
- Clients and servers can break HTTP messages into discrete frames, send them interlaced, and then reassemble them at the other end.
Server push
- 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
- Support for encoding header fields of transports through static Huffman code, reducing the size of individual transports.
- 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.