Much like HTTP, WebSocket is a communications protocol between a web browser and an Origin Server that operates on both standard ports TCP 80 and 443. Instead of a series of connections, WebSockets allow a long-held single connection to be established between the client and server.
WebSockets are commonly used in applications that require continuous communication (think of a chat application that has lengthy, continuous sessions). Web Sockets allow full-duplex, bi-directional instant communication over a low latency connection.
StackPath allows you to proxy your WebSocket connections through the CDN simply by enabling a setting in your CDN Stack.
What is WebSocket?
Much like HTTP, WebSocket is a communications protocol that operates on both port TCP 80 and 443. However, unlike HTTP, WebSocket is Full Duplex meaning the server can send data to the client without first receiving a request to do so. This reduces the overhead required compared to HTTP Long Polling and facilitates real-time data transfer between the client and the server.
Why use WebSocket?
The Full Duplex and real-time nature of WebSocket makes it particularly useful in any instances where multiple users are collaborating, or when server-side data which the user is interested in is constantly being updated. For example:
- Social applications, including social feeds and multimedia chat
- Multiplayer games
- Real-time multi-user collaboration tools
- Clickstream data tracking
- Live event reporting, such as sports matches or financial tracking
How to Enable WebSocket on Your Stack
- Login to your StackPath Control Portal.
- Navigate to your site and click the Settings option on the left menu bar.
- Under the Origin header, find the WebSockets option and click the toggle to enable WebSocket proxy support.
StackPath considers WebSocket traffic and HTTP traffic the same, therefore you will not be charged for ingress traffic and will be billed at your regular rate for egress traffic.
We actively monitor resource usage across our network to ensure there is adequate capacity for all customers to provide great service to users. As such we do not have any specific limits on the number of WebSocket connections that customers can take advantage of. StackPath does reserve the right to limit the number of WebSocket connections available if required.
WebSocket and WAF
Except for the initial HTTP request to establish the connection, WebSocket traffic bypasses the StackPath WAF and connections will not be inspected.
If you have any questions or concerns about WebSockets and how the StackPath system interacts with the protocol, feel free to reach out to our 24/7 live support team, we'll be happy to help.