Video chat system with audio volume dependent on your proximity to others. This naturally promotes forming groups, ideal for social gatherings.
https://user-images.githubusercontent.com/1223300/144045970-6c81b70b-3337-4c12-b51f-09563d2c3600.mp4
The project uses mediasoup for WebRTC audio and video sharing, and using uWebSockets.js for the WebRTC signaling, as well as our own additions such as position broadcasting with the least possible latency.
The directory public/room
contains a room config file and a background image.
Proximity Chat can run in SSL mode and non-SSL mode. However, non-SSL mode is mostly intended for setups where Proximity Chat runs behind a (reverse) proxy server terminates the SSL connection:
To run in SSL mode, set the SSL_CERT_PATH
and SSL_KEY_PATH
environment variables when invoking yarn start
.
For local development you need to generate a self-signed certificate as voice media can only be requested (MediaDevices.getUserMedia()
) over secure connections:
yarn gen-ssl-certs
With those files, you can run the server using:
export SSL_CERT_PATH="./cert/cert.pem" SSL_KEY_PATH="./cert/key.pem"
Or to wherever the key files are located on your production server.
Install dependencies with yarn install
and run with yarn start
. Open https://127.0.0.1:3000
, https://yourexternalip:3000
, or https://yourlanip:3000
in a supporting browser on multiple devices.
For running in production, make sure to set the ANNOUNCED_IP
environmental variable to the external IP of your server.
Proximity Chat can run in a Docker container. Use the following steps to build and run using Docker:
docker build -t proximity-chat .
docker run -d -p 3000:3000 -p 9001:9001 -v "/$(pwd)\public":/usr/src/app/public:ro -v "/$(pwd)\cert":/usr/src/app/cert:ro -e SSL_CERT_PATH="./cert/cert.pem" -e SSL_KEY_PATH="./cert/key.pem" proximity-chat
This also binds your local public
directory to the container, so that you can test frontend changes more quickly.
If you don't already have cert.pem
and key.pem
files, run yarn gen-ssl-certs
before running these commands. If the certificates you're using are not embedded into the image, make them available to the Docker machine using a volume (similar to the given -v
flag) and pass the appropriate values for SSL_CERT_PATH
and SSL_KEY_PATH
.
Find the IP address of the virtual machine that runs this using docker-machine ip
. You may want to enable port forwarding from your machine's network IP to the VM's IP, so you can access the VM from other devices in your network.
Please lint and commit-lint all commits. This is automatically checked on pull requests.