This topic provides answers to some frequently asked questions about WebSocket and WebSocket Secure.

What are WebSocket and WebSocket Secure?

WebSocket is an HTML5 protocol, which implements full-duplex communication between browsers and servers. WebSocket allows you to establish real-time communication and save server and bandwidth resources. WebSocket is similar to HTTP, which transfers data over TCP. However, WebSocket and HTTP have the following differences:

One major difference between WebSocket and HTTP is that WebSocket is a two-way communication protocol. After a connection is established over WebSocket, a WebSocket server and client can send or receive data between each other similar to a socket. The WebSocket server and client must complete a handshake to establish communication.

WebSocket Secure is a secure version of WebSocket.

Why do I use WebSocket/WebSocket Secure

New web applications emerge as the Internet develops. These applications, such as live video streaming and online chat rooms, require that servers have real-time pushing capabilities. To achieve this, a large number of websites used the polling technique in the past. When the polling technique is used, the browser sends HTTP requests to the server at specific intervals, such as every second. Then, the server returns the most recent data to the browser of the client. One disadvantage of this technique is that bandwidth resources are wasted. The browser must constantly send requests to the server, and the HTTP request header is long and does not contain a large amount of valid data.

To solve this problem, HTML5 defines WebSocket, which helps save server and bandwidth resources and facilitates real-time communication. WebSocket enables full-duplex communication between the browser and the server, and allows the server to proactively send data to the client.

The following figure shows the interaction process over WebSocket.

How do I enable WebSocket/WebSocket Secure for a CLB instance?

You do not need to perform configurations.
  • By default, HTTP listeners support WebSocket.
  • By default, HTTPS listeners support WebSocket Secure.
Note However, you must upgrade the CLB instance to a high-performance instance. For more information, see FAQ about high-performance SLB instances.

Supported regions

WebSocket and WebSocket Secure are available in all regions.


The following section describes the limits on WebSocket and WebSocket Secure:

  • CLB is connected to backend ECS instances by using HTTP/1.1. We recommend that you use web servers that support HTTP/1.1 for backend ECS instances.
  • If no packet is transferred between a CLB instance and a backend ECS instance within 60 seconds, the connection is closed. If you want the connection to remain open, enable the keepalive feature to ensure that a packet is transferred within every 60 seconds.


WebSocket and WebSocket Secure are free of charge.