This is an old revision of the document!


How to setup LSWS as WebSocket Proxy?

WebSocket changes the way the Internet works: It is a protocol that allows the server and the client can have a bidirectional conversation. The client doesn’t just request content from the server. The server also sends content to the client whenever there’s content to be sent (without waiting to be asked). This bidirectional conversation allows for realtime web experiences. While HTTP tries to simulate real-time interaction at great expense (through incessant refreshing), WebSocket makes realtime interaction a reality. This upgrades all sorts of web applications: stock tickers, data center monitors, news feeds… But probably the most exciting feature of realtime Internet is the ability for multiple users to see and react to things they each do in real time.

LiteSpeed Web Server can work as WebSocket proxy. The following wiki explains the detailed steps on how to set this up.

The first step is to have a WebSocket backend set up, but how to set up working WebSocket backend is out of this wiki's scope. You can consult online tutorials. One of the examples is to use Nginx backend running with nchan module.

Assuming you have backend WebSocket up and running on port 80 at

ws://domain.com/sub/xx1

. You will need to test it to ensure it is working.

There are many tools available for such testing. You can either try some online tools such as https://websocket.org/echo.html or download chrome extension tools like Simple WebSocket Client. We will use Chrome Simple WebSocket Client as an example in this wiki.

It tested successfully.

If it failed, you will see Simple WebSocket Client undefined error.

LSWS Web Console → Virtual Host (Native) → General → Web Socket Proxy Setup

Set up URI and address.

Save and restart LSWS

Test front-end port 443 wss:example.com/sub/xx1''. All working fine.

  • Admin
  • Last modified: 2018/01/19 20:12
  • by Jackson Zhang