This repo is provided as an example only and may not be appropriate for your use case.
You can retrieve your API key by visiting https://accounts.simplewebrtc.com.
The backend here signs a JSON object with an API Secret creating a JWT. The entirety of the backend lives here in the index.js file
The backend is invoked by retrieving some JSON data from the /generateUserData
route.
The result of this request is parsed as JSON and then set to the userData
attribute of the App
Component. See the docs for more info on how to retrieve the data from peers to use in your app.
In this example the userId
key from user data is rendered in the PeerGridItem
.
npm i
SWRTC_API_KEY=<YOUR_API_KEY> npm run build:app
SWRTC_API_SECRET=<YOUR_SECRET_KEY> npm start
- Go to https://localhost:5000/
- Ensure that docker is installed on your host
docker build --build-args SWRTC_API_KEY=<YOUR_API_KEY> --tag <your-tag> .
docker push <your-tag>
docker run -e SWRTC_API_SECRET=<YOUR_API_SECRET> <your-tag>
Note: docker run
may require you to map the internal port with -p 5000:5000
or --net=host
depending on your host configuration
Sound effects for peers joining/leaving, messages, and sound output testing can be configured.
Put your audio files into the /public
directory, and uncomment the desired <meta />
tags in /public/index.html
, setting the content
attribute to the URL of the audio file:
<meta name="simplewebrtc-sound-message-receive" content="/url-of-mp3-file" />
<meta name="simplewebrtc-sound-message-send" content="/url-of-mp3-file" />
<meta name="simplewebrtc-sound-peer-enter" content="/url-of-mp3-file" />
<meta name="simplewebrtc-sound-peer-exit" content="/url-of-mp3-file" />
<meta name="simplewebrtc-sound-test-output" content="/url-of-mp3-file" />