Updated on 2024-04-25 GMT+08:00

WebSocket Settings

If you have enabled whole site acceleration in scenarios such as on-screen commenting, collaborative session, market data broadcast, sports live update, online education, and IoT, you can configure WebSocket to implement long-term bidirectional data transmission.

Background

WebSocket is a protocol providing full-duplex communication channels over a single TCP connection. It allows a server to proactively push data to clients, simplifying data exchange between the clients and server. A persistent connection can be established between a browser and the server after one handshake and bidirectional data transmission can be performed, saving server resources and bandwidth.

Precautions

  • This function applies only to domain names whose service type is whole site acceleration.
  • This function is in OBT and is available for free trial.
  • The maximum timeout interval is 300 seconds. If no message is transferred within the specified interval, the connection is closed.
  • WebSocket cannot be configured for domain names with special configurations.
  • Do not enable both WebSocket and HTTP/2. Otherwise, your domain name cannot be accessed.

Procedure

  1. Log in to Huawei Cloud console. Choose Service List > Content Delivery & Edge Computing > Content Delivery Network.

    The CDN console is displayed.

  2. In the navigation pane, choose Domains.
  3. In the domain list, click the target domain name or click Configure in the Operation column.
  4. Click the Advanced Settings tab.
  5. In the WebSocket Settings area, click Edit.
    Figure 1 WebSocket Settings
  6. Enable Status, set a proper timeout interval (1s to 300s), and click OK.