The sixth chapter design program Architecture design realizes WebSocket strategy

Source: Internet
Author: User

1. Overview

Traditional Web pages are communicated in the form of a request-the corresponding mode, each request-corresponding to a new connection. The establishment and disconnection of a connection also requires resource consumption.

WebSocket is a TCP protocol that enables two-way communication on a single connection.

This chapter includes asynchronous reading and writing of strings and binary data, selection of connection loss policies, and when to use WebSocket.

2. Main content

2.1 Asynchronous read and write string and binary data

HTTP polling is a traditional way of using a series of AJAX requests to achieve long-lasting connections on the client side (seemingly long-lasting connections).

HTTP Long Polling is a service-side technology used by clients when using AJAX to request a server. is implemented by blocking incoming requests until the current request operation is complete. In HTTP, this is not a good way, because the request-response pattern for HTTP is not designed for this scenario. And this is not a reliable way, there may be a connection interruption situation.

WebSockets is a new technology that supports duplex communication.

Not to be continued ...

The sixth chapter design program Architecture design realizes WebSocket strategy

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.