If you want your origin server to allow WebSocket requests whose URLs begin with ws://
or wss://
, you can use the WebSocket feature on Edge Security Acceleration (ESA). With this feature enabled (which it is by default), ESA can communicate with the origin server over the WebSocket protocol to transmit and update data in real time.
Background information
WebSocket is a TCP-based protocol that implements persistent and full-duplex communications between a client and a server, allowing the server to actively send information to the client. Before WebSocket, web applications had to make inquiries for duplex communications by continuously sending HTTP requests, which was inefficienct and costly. WebSocket requires only one handshake between the client and the server to establish a persistent connection and implement bi-directional data transmission. This saves server resources and bandwidth, and ensures communications in real time.
Supported ports
80
443
Scenarios
Live commenting
User A posts a comment from a mobile phone and wants to view live comments from other clients on the phone. To meet this requirement, WebSocket is used to push the live comments from other clients to the mobile phone of User A. This way, User A can view the live comments sent by other users.
Online education
In one-to-many online education scenarios, WebSocket can be used to push the notes and syllabuses edited on the client of the teacher to the clients of the students in real time.
Real-time quotes for financial products
Constantly changing stock and gold prices can be pushed to clients around the world in real time over the WebSocket protocol. This facilitates financial decision-making in trading.
Live sportscasts
Live sportscasts are the top concern of a large number of sports fans all over the world. WebSocket satisfies the requirements of these sports fans by providing real-time sports updates.
Video conferencing
Video conferencing is adopted in a wide range of scenarios, where participants join the conference from multiple devices. WebSocket helps deliver real-time information to these participants.
Location-aware applications
An increasing number of developers apply the GPS capabilities of mobile devices to location-aware applications. Based on the physical user location that is continuously updated, the location-aware applications provide tailored offerings and information to users.
Procedure
Log on to the ESA console.
In the left-side navigation pane, click Websites.
On the Websites page, find the website that you want to manage, and click the website name or View Details in the Actions column.
In the left-side navigation pane, click Speed and Network, and choose the Network Optimization tab.
Turn on or off the WebSocket switch based on your business requirements. By default, the switch is on. See Origin certificates if you want to set a separate origin port for WebSocket.