Skip to content

Commit a4f8649

Browse files
authored
Merge pull request #3130 from element-hq/fkwp/update_readme
Add endpoint routing to README.md
2 parents 3ce9d71 + 79404fc commit a4f8649

File tree

5 files changed

+70
-16
lines changed

5 files changed

+70
-16
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ deployment for three different sites A, B and C is depicted below.
9797

9898
MatrixRTC backend (according to
9999
[MSC4143](https://github.com/matrix-org/matrix-spec-proposals/pull/4143))
100-
is announced by the homeserver's `.well-known/matrix/client` file and discovered
100+
is announced by the Matrix site's `.well-known/matrix/client` file and discovered
101101
via the `org.matrix.msc4143.rtc_foci` key, e.g.:
102102

103103
```json
104104
"org.matrix.msc4143.rtc_foci": [
105105
{
106106
"type": "livekit",
107-
"livekit_service_url": "https://someurl.com"
107+
"livekit_service_url": "https://matrix-rtc.example.com/livekit/jwt"
108108
},
109109
]
110110
```
@@ -227,8 +227,8 @@ The easiest way to develop new test is to use the codegen feature of Playwright:
227227
npx playwright codegen
228228
```
229229

230-
This will record your action and write the test code for you. Use the tool bar to test visibility, text content,
231-
clicking.
230+
This will record your action and write the test code for you. Use the tool bar
231+
to test visibility, text content and clicking.
232232

233233
##### Investigate a failed test from the CI
234234

@@ -246,8 +246,8 @@ Unzip the report then use this command to open the report in your browser:
246246
npx playwright show-report ~/Downloads/playwright-report/
247247
```
248248

249-
Under the failed test there is a small icon looking like "3 columns" (next to test name file name),
250-
click on it to see the live screenshots/console output.
249+
Under the failed test there is a small icon looking like "3 columns" (next to
250+
the test name file name), click on it to see the live screenshots/console output.
251251

252252
### Test Coverage
253253

docs/MSC4195_setup.drawio.png

17.9 KB
Loading
20.3 KB
Loading

docs/element_call_widget.drawio.png

18.8 KB
Loading

docs/self-hosting.md

Lines changed: 64 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ required for Element Call to work properly:
3030
sync v2 API that allows them to correctly track the state of the room. This is
3131
required by Element Call to track room state reliably.
3232

33-
If you're using [Synapse](https://github.com/element-hq/synapse/) as your homeserver, you'll need
34-
to additionally add the following config items to `homeserver.yaml` to comply with Element Call:
33+
If you're using [Synapse](https://github.com/element-hq/synapse/) as your
34+
homeserver, you'll need to additionally add the following config items to
35+
`homeserver.yaml` to comply with Element Call:
3536

3637
```yaml
3738
experimental_features:
@@ -64,35 +65,88 @@ required for each site deployment.
6465
6566
![MSC4195 compatible setup](MSC4195_setup.drawio.png)
6667
67-
As depicted above, Element Call requires a
68+
As depicted above in the `example.com` site deployment, Element Call requires a
6869
[Livekit SFU](https://github.com/livekit/livekit) alongside a
6970
[Matrix Livekit JWT auth service](https://github.com/element-hq/lk-jwt-service)
7071
to implement
7172
[MSC4195: MatrixRTC using LiveKit backend](https://github.com/hughns/matrix-spec-proposals/blob/hughns/matrixrtc-livekit/proposals/4195-matrixrtc-livekit.md).
7273

74+
#### Matrix site endpoint routing
75+
76+
In the context of MatrixRTC, we suggest using a single hostname for backend
77+
communication by implementing endpoint routing within a reverse proxy setup. For
78+
the example above, this results in:
79+
| Service | Endpoint | Example |
80+
| -------- | ------- | ------- |
81+
| [Livekit SFU](https://github.com/livekit/livekit) WebSocket signalling connection | `/livekit/sfu` | `matrix-rtc.example.com/livekit/sfu` |
82+
| [Matrix Livekit JWT auth service](https://github.com/element-hq/lk-jwt-service) | `/livekit/jwt` | `matrix-rtc.example.com/livekit/jwt` |
83+
84+
Using Nginx, you can achieve this by:
85+
86+
```jsonc
87+
server {
88+
...
89+
location ^~ /livekit/jwt/ {
90+
proxy_set_header Host $host;
91+
proxy_set_header X-Real-IP $remote_addr;
92+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
93+
proxy_set_header X-Forwarded-Proto $scheme;
94+
95+
# JWT Service running at port 8080
96+
proxy_pass http://localhost:8080/;
97+
}
98+
99+
location ^~ /livekit/sfu/ {
100+
proxy_set_header Host $host;
101+
proxy_set_header X-Real-IP $remote_addr;
102+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
103+
proxy_set_header X-Forwarded-Proto $scheme;
104+
105+
proxy_send_timeout 120;
106+
proxy_read_timeout 120;
107+
proxy_buffering off;
108+
109+
proxy_set_header Accept-Encoding gzip;
110+
proxy_set_header Upgrade $http_upgrade;
111+
proxy_set_header Connection "upgrade";
112+
113+
# LiveKit SFU websocket connection running at port 7880
114+
proxy_pass http://localhost:7880/;
115+
}
116+
}
117+
```
118+
119+
#### MatrixRTC backend announcement
120+
73121
> [!IMPORTANT]
74122
> As defined in
75123
> [MSC4143](https://github.com/matrix-org/matrix-spec-proposals/pull/4143)
76-
> MatrixRTC backend must be announced to the client via your **homeserver's
77-
> `.well-known/matrix/client`**. The configuration is a list of Foci configs:
124+
> MatrixRTC backend must be announced to the client via your **Matrix site's
125+
> `.well-known/matrix/client`** file (e.g.
126+
> `example.com/.well-known/matrix/client` matching the site deployment example
127+
> from above). The configuration is a list of Foci configs:
78128

79129
```json
80130
"org.matrix.msc4143.rtc_foci": [
81131
{
82132
"type": "livekit",
83-
"livekit_service_url": "https://someurl.com"
133+
"livekit_service_url": "https://matrix-rtc.example.com"
84134
},
85-
{
135+
{
86136
"type": "livekit",
87-
"livekit_service_url": "https://livekit2.com"
137+
"livekit_service_url": "https://matrix-rtc-2.example.com"
88138
},
89139
{
90-
"type": "another_foci",
91-
"props_for_another_foci": "val"
140+
"type": "nextgen_new_foci_type",
141+
"props_for_nextgen_foci": "val"
92142
}
93143
]
94144
```
95145

146+
> [!NOTE]
147+
> Most `org.matrix.msc4143.rtc_foci` configurations will only have one entry in
148+
> the array
149+
96150
## Building Element Call
97151

98152
> [!NOTE]

0 commit comments

Comments
 (0)