LiteSpeed Web Server Users' Manual

Version 5.1 Rev. 2

Web Socket Proxy

WebSocket is a protocol that can be used instead of HTTP to deliver real-time, bidirectional communication over the Internet. Starting with version 1.1.1, OpenLiteSpeed supports WebSocket backends through the use of WebSocket proxies. These proxies send the WebSocket communication to the appropriate backend stipulated in the {ITEM=wsaddr} field.

Table of Contents

Web Socket Proxy

URI | Address | 

URIGo to top
Description: Specifies the URI(s) that will use this WebSocket backend. Traffic to this URI will only be forwarded to the WebSocket backend when it contains a WebSocket upgrade request.

Traffic without this upgrade request will automatically be forwarded to the Context that this URI belongs to. If no Context exists for this URI, LSWS will treat this traffic as though it is accessing a static context with the location $DOC_ROOT/URI.
Syntax: The URI can be a plain URI (starting with "/") or a Perl-compatible regular expression URI (starting with "exp:"). If a plain URI ends with a "/", then this WebSocket backend will include all sub-URIs under this URI.
Example: Using the WebSocket proxy in conjunction with a Context allows you to serve different kinds of traffic in different ways on the same page, thus optimizing performance. You can send WebSocket traffic to the WebSocket backend, while setting up a static context so that LSWS can serve the page's static content, or an LSAPI context so LSWS will serve PHP content (both of which LSWS does more efficiently than the WebSocket backend).
AddressGo to top
Description: A unique socket address used by the WebSocket backend. IPv4 sockets, IPv6 sockets, and Unix Domain Sockets (UDS) are supported. IPv4 and IPv6 sockets can be used for communication over the network. UDS can only be used when the WebSocket backend resides on the same machine as the server.
Syntax: IPv4 or IPV6 address:port or UDS://path
Example: 127.0.0.1:5434
UDS://tmp/lshttpd/php.sock.
Tips: [Security] If the WebSocket backend runs on the same machine, UDS is preferred. If you have to use an IPv4 or IPv6 socket, set the IP address to localhost or 127.0.0.1, so the WebSocket backend is inaccessible from other machines.
[Performance] Unix Domain Sockets generally provide higher performance than IPv4 or IPv6 sockets.