Skip to content

Commit 1aa24fd

Browse files
Merge pull request #101 from dank074/voice-docs
add docs for voice configuration
2 parents 839e1c8 + df80902 commit 1aa24fd

File tree

3 files changed

+93
-4
lines changed

3 files changed

+93
-4
lines changed

docs/faq.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
The big Discord.com features currently left unimplemented or with partial implementations are:
1313

14-
* Voice/Video support
14+
* Voice/Video support (WebRTC protocol support implemented, but lacking UDP protocol implementation)
1515
* Voice activities
1616
* OAuth2 scopes and other applications (Bot applications work by are left unscoped)
1717
* Message threads
@@ -31,10 +31,12 @@
3131

3232
??? info "Voice/Video when?"
3333

34-
Currently there is no voice or video support in any {{ project.name }} instance.
34+
Currently there is experimental voice/video WebRTC support in {{ project.name }}. UDP connections are not currently supported.
35+
3536
This is a very difficult feature to get working, especially given that
36-
we must implement it the exact same way as Discord.com for client compatibility.
37-
[We would be incredibly thankful for any assistance.](/contributing)
37+
we must implement it the exact same way as Discord.com for client compatibility, so if you find any bugs please open an issue in [{{ project.name }} server]({{ repositories.base_url }}/{{ repositories.server }}).
38+
39+
[We would also be incredibly thankful for any assistance.](/contributing)
3840

3941
??? info "Free Nitro?"
4042

docs/setup/server/voice.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Voice
2+
3+
**Currently only WebRTC connections are supported. UDP connections will be dropped**
4+
5+
Voice support is left as an optional dependency in {{ project.name }}, which means that it is disabled by default unless you decide to install additional dependencies. {{ project.name }} is designed so that anyone can develop a voice package compatible with the project as long as the implementation adheres to the [WebRTC types]({{ repositories.base_url }}/{{ repositories.voice_types }}). Currently there are two sample implementations which can be used:
6+
7+
- [Medooze Implementation]({{ repositories.base_url }}/{{ repositories.voice_medooze }}) - Supports video&audio for guild voice, DM voice, as well as GoLive streams. Only supports Linux & MacOS environments.
8+
- [Mediasoup Implementation]({{ repositories.base_url }}/{{ repositories.voice_mediasoup }}) - Supports audio only for guild voice, DM voice, and GoLive streams. Supports Windows, Linux, and MacOS environments
9+
10+
## Configuring Voice Gateway
11+
12+
By default the Voice Gateway is set to run on port 3004. You can change this default configuration by setting your desired port it in your `.env`:
13+
14+
```.env
15+
WRTC_WS_PORT=3004
16+
```
17+
18+
You also have to configure the Voice Gateway endpoint in your database. In table `config` you can set the default region endpoint to your Voice Gateway domain. It is set to `localhost:3004` by default:
19+
20+
```
21+
"regions_available_0_endpoint": "localhost:3004"
22+
```
23+
24+
### Nginx reverse proxy for Voice Gateway
25+
26+
You will likely want to set your voice gateway behind a reverse proxy. Here's a sample Nginx configuration:
27+
28+
```nginx
29+
server {
30+
# Change server_name
31+
server_name voice.example.com;
32+
listen 80;
33+
34+
location / {
35+
# Only change this if Nginx and {{ project.name }} are not on the same machine.
36+
proxy_pass http://127.0.0.1:3004;
37+
proxy_set_header Host $host;
38+
proxy_pass_request_headers on;
39+
add_header Last-Modified $date_gmt;
40+
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
41+
proxy_set_header X-Real-IP $remote_addr;
42+
proxy_set_header X-Forwarded-Proto https;
43+
proxy_set_header X-Forwarded-For $remote_addr;
44+
proxy_set_header X-Forwarded-Host $remote_addr;
45+
proxy_no_cache 1;
46+
proxy_cache_bypass 1;
47+
48+
# This is important. It allows Websocket connections through NGINX.
49+
proxy_set_header Upgrade $http_upgrade;
50+
proxy_set_header Connection "upgrade";
51+
}
52+
}
53+
```
54+
55+
## Configuring Voice Library
56+
57+
You can install one of the provided sample implementations or you can choose to install another third-party one. Installation process will be the same regardless:
58+
59+
### Medooze implementation installation
60+
61+
1. First install the package in your {{ project.name }} server:
62+
63+
```
64+
npm install {{ npm_packages.voice_medooze }} --no-save
65+
```
66+
67+
2. Configure the package name in your {{ project.name }} server `.env`:
68+
69+
```
70+
WRTC_LIBRARY={{ npm_packages.voice_medooze }}
71+
```
72+
73+
3. Configure the public IP for your WebRTC server in your {{ project.name }} server `.env`. This should be a public IP that can be accessed from the internet if this is a production instance. It will be the address that will get sent to the client during the WebRTC connection negotiation:
74+
75+
```
76+
WRTC_PUBLIC_IP=127.0.0.1
77+
```
78+
79+
### Mediasoup implementation installation
80+
81+
The process is exactly the same as the Medooze installation, just replace the package name in the commands with ` {{ npm_packages.voice_mediasoup }} `

mkdocs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ extra:
1111
base_url: https://github.com
1212
server: spacebarchat/server
1313
client: spacebarchat/client
14+
voice_types: spacebarchat/spacebar-webrtc-types
15+
voice_medooze: spacebarchat/medooze-spacebar-wrtc
16+
voice_mediasoup: spacebarchat/mediasoup-spacebar-wrtc
1417
missing_routes: spacebarchat/missing-routes
1518
main: &repo_url https://github.com/spacebarchat/spacebarchat # This gets read by mkdocs without being pre-proccessed by mkdocs-macros, which is why the URL is in full.
1619
site:
1720
name: &site_name Spacebar Documentation
1821
description: &site_description "Documentation for Spacebar: a free open source selfhostable chat, voice and video discord-compatible platform"
1922
edit_uri: &edit_uri https://github.com/spacebarchat/docs/edit/master/docs/ # This gets read by mkdocs without being pre-proccessed by mkdocs-macros, which is why the URL is in full.
23+
npm_packages:
24+
voice_medooze: "@spacebarchat/medooze-webrtc"
25+
voice_mediasoup: "@spacebarchat/mediasoup-webrtc"
2026
site_name: *site_name
2127
repo_url: *repo_url
2228
edit_uri: *edit_uri

0 commit comments

Comments
 (0)