File: README.md

package info (click to toggle)
python-trame 3.12.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 101,620 kB
  • sloc: python: 13,515; sh: 183; javascript: 93; makefile: 7
file content (45 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download
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
# Server relay

The idea behind the server relay is to connect 2 client ws together and allow server process to act as a client.

WS  /proxy/xyz  =>  first: process ws / second: client 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 --mode relay
```

## Testing

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

```bash
python $TRAME_ROOT/examples/06_vtk/01_SimpleCone/RemoteRendering.py --reverse-url ws://localhost:8080/proxy/xyz-123
```

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/xyz-123`.
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/abc`.
Since no process is listening on 1235, the connection should fail.