Peer Calls
WebRTC peer to peer calls for everyone. See it live in action at peercalls.com.
Work in progress.
Requirements
- Node.js 8, or
- Node.js 12, or
- Docker
Stack
- Express
- Socket.IO
- React
- Redux
- TypeScript (since peer-calls
v2.1.0)
Installation & Running
Using npx (from NPM)
npx peer-calls
Installing locally
npm install peer-calls
./node_modules/.bin/peer-calls
Installing Globally
npm install --global peer-calls
peer-calls
Using Docker
Use the jeremija/peer-calls image from Docker Hub:
docker pull jeremija/peer-calls
docker run --rm -it -p 3000:3000 jeremija/peer-calls:latest
From Git Source
git clone https://github.com/jeremija/peer-calls.git
cd peer-calls
npm install
# for production
npm run build
npm start
# for development
npm run start:watch
Building Docker Image
git clone https://github.com/jeremija/peer-calls
cd peer-calls
docker build -t peer-calls .
docker run --rm -it -p 3000:3000 peer-calls:latest
Configuration
There has been a breaking change in v3.0.0. The default binary provided via
NPM is now called peer-calls, while it used to be peercalls. This has been made
to make npx peer-calls work.
Version 3 also changed the way configuration works. Previously, config module
was used to read config files. To make things simpler, a default STUN
configuration will now be used by default. Config files can still be provided
via the config/ folder in the working directory, but the extension read will
be .yaml instead of .json.
The config files are read in the following order:
node_modules/peer-calls/config/default.yamlnode_modules/peer-calls/config/${NODE_ENV}.yaml, ifNODE_ENVis setnode_modules/peer-calls/config/local.yaml./config/default.yaml./config/${NODE_ENV}.yaml, ifNODE_ENVis set./config/local.yaml
No errors will be thrown if a file is not found, but an error will be thrown
when the required properties are not found. To debug configuration issues,
set the DEBUG environment variable to DEBUG=peercalls,peercalls:config.
Additionally, version 3 provides easier configuration via environment variables. For example:
- Set STUN/TURN servers:
PEERCALLS__ICE_SERVERS='[{"url": "stun:stun.l.google.com:19302", "urls": "stun:stun.l.google.com:19302"}]' - Change base URL:
PEERCALLS__BASE_URL=/test- app will now be accessible atlocalhost:3000/test - Enable HTTPS:
PEERCALLS__SSL='{"cert": "/path/to/cert.pem", "key": "/path/to/cert.key"}' - Disable HTTPS:
PEERCALLS__SSL=undefined - Listen on a different port:
PORT=3001(default is3000) - Bind to specific IP or hostname:
BIND=127.0.0.1
See config/default.yaml for sample configuration.
By default, the server will start on port 3000. This can be modified by
setting the PORT environment variable to another number, or to a path for a
unix domain socket.
To access the server, go to http://localhost:3000 (or another port).
Testing
npm install
npm test
To run all tests and build production artifacts, run:
npm run ci
Browser Support
Tested on Firefox and Chrome, including mobile versions. Also works on Safari 13 on Mac OS.
Does not work on iOS 10, but should work on iOS 11 - would appreciate feedback!
For more details, see here:
Contributing
See Contributing section.
If you encounter a bug, please open a new issue! Thank you ❤️