WebRTC peer to peer calls for everyone. See it live in action at peercalls.com.
Work in progress.
- Node.js 8, or
- Node.js 12, or
- Docker
- Express
- Socket.IO
- React
- Redux
- TypeScript (since peer-calls
v2.1.0
)
npx peer-calls
npm install peer-calls
./node_modules/.bin/peer-calls
npm install --global peer-calls
peer-calls
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
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
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
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.yaml
node_modules/peer-calls/config/${NODE_ENV}.yaml
, ifNODE_ENV
is setnode_modules/peer-calls/config/local.yaml
./config/default.yaml
./config/${NODE_ENV}.yaml
, ifNODE_ENV
is 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).
By default, Peer Calls server will log only basic information. Client-side logging is disabled by default.
Server-side logs can be configured via the DEBUG
environment variable. Setting
it to peercalls,peercalls:*
will enable all server-side logging:
DEBUG=peercalls,peercalls:* npm run start:server
Client-side logs can be configured via localStorage.DEBUG
and
localStorage.LOG
variables:
- Setting
localStorage.LOG=1
enables logging of Redux actions and state changes - Setting
localStorage.DEBUG=peercalls,peercalls:*
enables all other client-side logging
Below are some common NPM scripts that are used for development:
npm start start the precompiled server.
npm run build build all client-side resources.
npm run start:server start and compile server-side TypeScript on the fly,
restarts the server when the resources change.
npm run start:watch start the server, and recompile client-side resources
when the sources change.
npm test run all tests.
npm run ci run all linting, tests and build the client-side
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:
- Do not require config files and allow configuration via environment variables. (Fixed in 23fabb0)
- Show menu dialog before connecting (Fixed in 0b4aa45)
- Reduce production build size by removing Pug. (Fixed in 2d14e5f c743f19)
- Add ability to share files (Fixed in 3877893)
- Enable node cluster support (to scale vertically).
- Add Socket.IO support for Redis (to scale horizontally).
- Generate public keys for each client, and allow each client to accept, deny, and remember allowed/denied connections to specific peers.
- Add support for browser push notifications
See Contributing section.
If you encounter a bug, please open a new issue! Thank you ❤️