File: README.md

package info (click to toggle)
python-trame 3.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 101,620 kB
  • sloc: python: 13,515; sh: 183; javascript: 93; makefile: 7
file content (46 lines) | stat: -rw-r--r-- 1,251 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Forward relay

The idea behind the forward relay is to serve static content from a local directory and forward ws connection to a local process running on a different port.

GET /*           =>  serve --www /path/to/dir
WS  /proxy/1234  =>  forward to ws://localhost:1234/ws

## Setup

```bash
# Working directory
mkdir -p test-relay && cd "$_"

# Virtual environment setup
python -m venv .venv
source ./.venv/bin/activate
pip install -U pip trame

# Generate static content
python -m trame.tools.www --output ./www

# Start relay
python -m wslink.relay --www ./www
```

## Testing

In a different terminal but with same venv run a test process

```bash
python $TRAME_ROOT/examples/06_vtk/01_SimpleCone/RemoteRendering.py --server --port 1234
```

Then try connecting your browser to the following set of URLs

### Working connection

Open your browser to `http://localhost:8080/index.html?sessionURL=ws://localhost:8080/proxy/1234`.
The application should work even when you reload the page.

If you open a second tab with that same URL, that one should fail.

### Invalid endpoint

Open your browser to `http://localhost:8080/index.html?sessionURL=ws://localhost:8080/proxy/1235`.
Since no process is listening on 1235, the connection should fail.