-
Book Overview & Buying
-
Table Of Contents
Modern JavaScript Applications
By :
Before we start building a chatroulette, let's see how to run our own instance of PeerServer.
PeerServer is available as an npm package on npm cloud. Let's create a custom PeerServer and use it with the PeerJS application that we built in our previous chapter.
First create a directory named Custom-PeerServer and place app.js and package.json files in it.
In the package.json file, place the following code and run the npm install command to download the PeerServer package:
{
"name": "Custom-PeerServer",
"dependencies": {
"peer": "0.2.8",
"express": "4.13.3"
}
}At the time of writing, the latest version of PeerServer is 0.2.8. Here, we will also download the express package, as we will need to demonstrate how to integrate PeerServer with Express.
PeerServer package provides a library to create a custom PeerServer or integrate PeerServer with Express and also an executable file to directly create our own instance of PeerServer without any customization.