Make a summary every day, persistence is victory!

/** @date 2021-07-02 @description 图 文 HTTP - Chapter 9 - HTTP function add-on protocol */Copy the code

One (Shortcomings of HTTP)

  1. Only one request can be sent on a connection
  2. Requests can only start from the client, which cannot accept instructions other than responses
  3. Request/response headers are sent uncompressed, and the more headers there are, the more latency there is
  4. Sending long headers, sending the same headers to each other every time causes more waste
  5. Optional data compression format, non – mandatory compression

Two (Ajax)

Ajax (Asynchronous JavaScript and XML- Asynchronous JavaScript and XML technology) is an Asynchronous communication method that effectively leverages JavaScript and DOM operations to achieve partial Web page replacement loading

The core technology of Ajax is an API called XMLHttpRequest. Through the invocation of JavaScript scripts, HTTP communication can be carried out with the server. By this means, a request can be made on the loaded Web page to achieve local page updates

3 (SPDY)

SPDY adds a session layer in the application layer and network layer of TCP/IP to control the flow of data, but HTTP is still used for communication. After using SPDY, HTTP has the following functions:

  1. Multiplexed streams: Unlimited processing of multiple HTTP requests over a single TCP connection
  2. Prioritize requests: Assign priority to requests one by one
  3. Compressing HTTP headers: Compressing request and response headers to reduce the number of packets produced and bytes sent by communication
  4. Push function: The server can actively push data to the client
  5. Server prompt function: the server can actively prompt the client to request the required resources

Boss (WebSocket)

WebSocket: Standard for full-duplex communication between Web browsers and Web servers

Once the client and the server establish the connection of WebSocket protocol communication, the client and the server can send data in various formats to each other in the process of communication

WebSocket features:

  1. Push function: the server can actively push data to the client
  2. Reduce traffic: Once a WebSocket connection is established, it is expected to remain connected. Compared with HTTP, it not only reduces the cost of each connection, but also reduces traffic due to the small size of the WebSocket header

Wu (Add: HTTP/2.0)

Differences between HTTP/2.0 and HTTP/1.1:

  1. HTTP / 2.0binaryProtocol rather than text protocol
  2. Multiplexing: Parallel requests can be made inThe sameConnection processing removes order and blocking constraints in HTTP/1.x
  3. Header compression: Because headers are often similar in a series of requests, it is removedrepeatandTransmitting duplicate dataThe cost of
  4. Server push mechanism: allows the server to populate the client cache with data, allowing the clientRequest in advance
  5. inCookieFirst introduced insecurityThe associated prefix helps ensure that a secure cookie has not been changed