The relationship between the three Cp/ip,spdy,websocket

Source: Internet
Author: User

According to the OSI network layered model, IP is the Network layer protocol, TCP is the Transport Layer protocol, and HTTP is the application layer protocol. Between these three, Spdy and WebSocket are HTTP-related protocols, and TCP is the HTTP underlying protocol.
One, the lack of HTTP

The HTTP protocol has been used for many years and has found some deficiencies, mainly in performance, including:
HTTP connection problems, the interaction between the HTTP client and the server is in Request/answer mode, when the client requests, an HTTP connection is established, then the request message is sent, the service side gives the reply message, and then the connection is closed. (later HTTP1.1 support for persistent connections)
Because TCP connections are built up with overhead, the overhead of using SSL/TLS is even greater.
In a browser, a Web page contains many resources, including html,css,javascript, pictures, and so on, so that when you load a Web page, you open multiple connections to the same server at the same time.
HTTP message header problem, now the client will send a large number of HTTP headers, because a Web page may require 50-100 requests, there will be quite a large amount of message header data.
HTTP communication mode problem, HTTP request/reply mode of the session are client-initiated, lack of server notification client mechanism, in the need to notify the scene, such as chat rooms, games, client applications need to constantly poll the server.

Spdy and WebSocket are part of these shortcomings from different angles. In addition to these two technologies, there are other technologies that are also making improvements in response to these shortcomings.
Second, SPDY

The main purpose of spdy is to reduce the page load time by more than 50%, but it does not increase the complexity of the deployment, does not affect the client and server-side Web applications, only the browser and Web servers to support Spdy. The main points are as follows:
Multiplexing, which runs multiple HTTP requests concurrently on a TCP connection. The request can be set to a priority level.
Remove unwanted HTTP headers and compress HTTP headers to reduce the required network bandwidth.
SSL is used as the transport protocol to provide data security.
Compressing the transferred data using gzip
Provides a mechanism by which the service initiates communication and pushes data to the client.
Essentially, Spdy is the protocol that replaces the HTTP underlying transport to speed up page load times without affecting HTTP semantics.
The solution of Spdy is to design a session layer protocol--frame protocol, solve the problem of multiplexing, priority, and then implement HTTP semantics on it.

Third, WebSocket

WebSocket provides a mechanism for two-way communication using a TCP connection, including network protocols and APIs to replace Web pages and servers using HTTP polling for two-way communication.
In essence, WebSocket is not limited to the HTTP protocol, but because of the large number of HTTP infrastructure, proxy, filtering, identity authentication, and so on, WebSocket borrow HTTP and HTTPS ports.

Because of the port using HTTP, the handshake message after the TCP connection is established is HTTP based, and the server determines whether this is an HTTP protocol or a websocket protocol. WebSocket Connection In addition to the establishment and shutdown of the handshake, data transmission and HTTP is not a little bit related.

WebSocket also has its own set of frame protocols.

Iv. the relationship between Spdy and WebSocket

The relationship between Spdy and WebSocket is more complicated.
Complementary relationship, the two focus on different. Spdy is more focused on accelerating the loading of web pages, while WebSocket emphasizes providing a two-way communication mechanism and API for Web applications.
competitive relationships, which overlap the problems they solve, such as Spdy and websocket on server push.
Hosting relationship, imagine that if Spdy's standardization is earlier than Websocket,websocket can focus on the API, using Spdy's frame mechanism and multiplexing mechanism to implement the API. Google has proposed a draft, saying WebSocket can run on Spdy. The WebSocket connection is based on the Spdy stream and maps the WebSocket frame to the spdy frame.
converged relationships, as Microsoft did in HTTP speed+mobility.

The relationship between the three Cp/ip,spdy,websocket

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.