Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create and run my own peerjs server?

I got the following code from the git-hub but I don't know how to use and execute.

 $> npm install peer   --->where i want to install this node_module ?
  //Run the server:

 $> peerjs --port 9000 --key peerjs     
         or
 var PeerServer = require('peer').PeerServer;
 var server = new PeerServer({port: 9000, path: '/myapp'});

what's the difference between above steps. when and where to use those steps.

like image 683
John Avatar asked Oct 15 '14 05:10

John


People also ask

Is PeerJS open source?

PeerJS provides an open source implementation of this connection broker server PeerJS Server (written in Node. js), in case you do not want to use their cloud-hosted version (which is free right now, and comes with some limitations).

Is PeerJS part of WebRTC?

But there is some good news; PeerJS is a WebRTC framework that abstracts away all of the ice and signalling logic so that you can focus on the functionality of your application. There are two parts to PeerJS, the client-side framework and the server.


1 Answers

After npm install peer go to /root/node_modules/peer/node_modules/ws. Then add something like

var PeerServer = require('peer').PeerServer;
var server = PeerServer({port: 443, path: '/peerjs'});

in index.js and start the server with nodejs /root/node_modules/peer/node_modules/ws/index.js

like image 181
Socke Avatar answered Sep 25 '22 06:09

Socke