Now, we can do the same, but with the help of the PeerJS library. In the previous example, you may notice that we can do a call only between two peers. In the following example, we will show you how we can initiate a call between more than two peers.
PeerJS is a wrapper for the browser's WebRTC implementation. It is aimed to simplify the peer-to-peer connection management. PeerJS provides a functionality to list the connected clients.
We will create a simple Node.js application with peer module. For example, we will add two modules:
ip. We can do this with the following commands:
$ npm install peer --save $ npm install ip --save
After this installation, the