WebSocket explanation and how to be compatible with low-version browsers

Source: Internet
Author: User

WebSocket similar to the HTTP protocol, is to compensate for the HTTP protocol flaw: Communication can only be initiated by the client, the HTTP protocol does not make the server actively push information to the client.

The WebSocket agreement was born in 2008 and became an international standard in 2011. All browsers are already supported.

Its biggest feature is that the server can proactively push information to the client, the client can also actively send information to the server, is a true two-way equality dialogue, is a server push technology.

Other features include:
(1) based on the TCP protocol, the server-side implementation is relatively easy.
(2) Good compatibility with HTTP protocol. The default port is also 80 and 443, and the handshake phase uses the HTTP protocol, so the handshake is not easy to block, through a variety of HTTP proxy server.
(3) The data format is lighter, the performance overhead is small, and the communication is efficient.
(4) You can send text, or you can send binary data.
(5) The client can communicate with any server without the same origin limitation.
(6) The protocol identifier is WS (or WSS if encrypted) and the server URL is the URL.

ws://example.com:80/some/path

Usage method (client, server side): http://www.ruanyifeng.com/blog/2017/05/websocket.html

For low-end browsers that do not support websocket, there are typically several solutions

    1. Implementation of Pseudo-websocket communication using polling or long connections

    2. Implement a WebSocket client using Flash or another method: https://segmentfault.com/q/1010000005000671/a-1020000005003936

    3. 17532465


Article Source: http://www.ruanyifeng.com/blog/2017/05/websocket.html

WebSocket explanation and how to be compatible with low-version browsers

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.