What is the difference between HTTP & WebSocket? Do you know?

What is the difference between HTTP & WebSocket? Do you know?

[[412152]]

1 What is WebSocket?

WebSocket was born to meet the growing demand for real-time communication based on the Web. It solves the problem that the browser must poll for a long time when the client initiates multiple HTTP requests to the server resources. It implements multiplexing and is a full-duplex, bidirectional, single-socket connection. Under the WebSocket protocol, the server and the client can send information at the same time.

2 Similarities and Differences between WebSocket and Http

same:

  • Built on top of TCP, data is transmitted through the TCP protocol.
  • Both are reliable transmission protocols.
  • They are all application layer protocols.

different:

  • WebSocket is a protocol in HTML5 that supports persistent connections, but HTTP does not support persistent connections.
  • HTTP is a one-way protocol that can only be initiated by the client. The server cannot actively push information to the client.

3 WebSocket and Socket

Socket itself is not a protocol. It works at the session layer of the OSI model. It is a socket, an API of the TCP/IP network, and an abstract layer that exists to facilitate people to directly use lower-level protocols. Socket is actually a facade mode, which hides the complex TCP/IP protocol family behind the Socket interface. For users, a set of simple interfaces is all that is needed, allowing Socket to organize data to comply with the specified protocol.

WebSocket is a typical application layer protocol.

4 WebSocket HTTP and TCP/IP

WebSocket, like HTTP, is built on top of TCP and transmits data through TCP.

http and websocket cannot be said to be two completely equal and separate things. To be precise, websocket should be regarded as a subordinate category of http.

References

  • https://zhihu.com/question/29615964
  • https://cnblogs.com/mengbin0546/p/12508848.html

<<:  AT&T announces 5G network now covers 250 million people

>>:  South Korea pushes for independence of 6G core technology

Recommend

What is Open RAN?

Open RAN is an industry standard designed to powe...

5G is the new infrastructure, but it also faces practical problems

Labs Guide When we browse Moments and watch video...

How big data empowers 5G value operation and maintenance

The background and significance of data empowerin...

How to solve Wi-Fi authentication problems?

Many people have encountered this problem when co...

The three major operators are accelerating their computing power

Computing power is the core of cloud computing. W...

The only way an OSPF router cannot become a DR/BDR is: DR priority = 0

After learning the DR/BDR selection rules in OSPF...

Looking forward to the love and hate of IPv6 deployment in the new Internet era

With the explosive development of the Internet, t...

DesiVPS: Los Angeles/Netherlands/India data centers, KVM VPS from $20 per year

DesiVPS acquired LosAngelesVPS a month ago and is...

F5: User-oriented, solving the complexity of multi-cloud environment

The fourth industrial revolution led by digital t...

5G cannot enhance industry?

There are already more than 1,100 “5G+Industrial ...

Hosteons announces that it will switch to KVM for free for OpenVZ users

Hosteons released the OpenVZ 7 VPS Migration to K...