When you have several instances of the ESP WebSocket
Web Service Provider which need to serve a large number of connections, you can use a
reverse proxy to help manage these connections. To proxy WebSocket traffic to Jetty, you can
use the Apache mod_proxy_wstunnel module. However, this module does not support load
balancing.
Reverse Proxy Example
Here is an example of using the Apache mod_proxy_wstunnel module to manage two
instances of the ESP WebSocket Provider, WSP1 and
WSP2, running on two separate machines, host1 and host2. First, to proxy WebSocket
traffic define mappings to include the WS(S)
protocol:
ProxyPass /WSP1 ws://host1:9092
ProxyPass /WSP2 ws://host2:9092
Assuming that the Apache server is running on a machine named proxyhost which is
running on port 9091, change the URI used to access the WebSocket service to include
the mappings. For example, if using the WebSocket Provider in REST-like mode,
instead of
ws:// host1:9092 to ws://proxyhost:9092/WSP1
or if
using the WebSocket Provider in streaming mode, instead
of
ws://proxyhost:9092/subscribe/ws1/p1?<auth>[<subscription-options]
use
ws:// proxyhost:9092/WSP1/subscribe/ ws1/p1?<auth>[<subscription-options]