Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

WebSocket

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

The reason for this is:

The "request-reply" mode of HTTP is "half-duplex". Although it can send and receive data in both directions, it can only act in one direction at a time, and the transmission efficiency is low.

More importantly, it is a "passive" communication mode, in which the server can only "passively" respond to the client's request and cannot actively send data to the client.

Not suitable for the development of "real-time communication" applications, low efficiency, difficult to achieve dynamic pages, so the emergence of WebSocket.

WebSocket

WebSocket is a lightweight network communication protocol based on TCP, which is on a par with HTTP in status.

WebSocket is a "full-duplex" communication protocol, which is equivalent to a "thin package" of TCP to run in a browser environment.

WebSocket uses HTTP-compatible URI to discover services, but defines new protocol names "ws" and "wss", and port numbers 80 and 443.

WebSocket uses HTTP protocol to realize the connection handshake. Sending GET requests requires "protocol upgrade". There is a very simple authentication mechanism in the handshake process to prevent misconnection.

WebSocket is a true "full-duplex" communication protocol, and like TCP, both the client and the server can send data to each other at any time. Once there is new data in the background, the server can immediately "push" to the client, without the need for client polling, the efficiency of "real-time communication" is also improved.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report