ws-tunnel

WebSocket tunnel from local machine to your global server.

Usage no npm install needed!

<script type="module">
  import wsTunnel from 'https://cdn.skypack.dev/ws-tunnel';
</script>

README

WS-Tunnel

WebSocket tunnel from local machine to your global server.

Scheme

Scheme

Server-side

Server start WebSocet server for local machine, and HTTP server for requests to local machine.

Usage

Install module and run server.

Like localy npm module from module folder:

npm run server -- {options}

Like localy npm module:

$(npm bin)/ws-tunnel-server {options}

Like global module:

ws-tunnel-server {options}

Options

  • -H, --host [host] — Host of tunnel. Default 0.0.0.0
  • -P, --port [number] — Port of tunnel. Default 4488
  • -h, --server-host [host] — Host of listener server. Default 0.0.0.0
  • -p, --server-port [number] — Port of listener server. Default 4480
  • -m, --mask [number] — RegExp mask for searching tunnel name in server host. Default (\\w+)\\. (subdimain)
  • -t, --timeout [time] — Connection and request timeout. Default 5000 (5 sec)
  • -s, --save — Save current options as preset (experimental)
  • -l, --list — List preset settings (experimental)

Client-side

Server open WebSocket connection with server-side instance, and requests you local host.

Usage

Install module and run server.

Like localy npm module from module folder:

npm run client -- {options}

Like localy npm module:

$(npm bin)/ws-tunnel {options}

Like global module:

ws-tunnel {options}

Options

  • -n, --name [name] — Name of tunnel. Default local
  • -h, --localhost [url] — Host for tunneling. Default http://localhost:4000
  • -t, --tunnel [url] — Socket URL of tunnel. Default ws://localhost:4488
  • -r, --reconnect [time] — Time for reconnection. Default 5000 (5 sec)
  • -s, --save — Save current options as preset
  • -l, --list — List preset settings