-
Install Node.js
- See https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
-
Create folder hold the EasyRTC application
- ex:
sudo mkdir /var/nodes
- ex:
sudo mkdir /var/nodes/easyrtc
- ex:
-
Security Considerations (not going into specifics)
- Create user for node.js (or use existing web user)
- chown the nodes folder to be owned by this user
- ensure the node is run as that user.
-
Download files from the server_example folder into your EasyRTC application folder.
-
Change to the easyrtc folder and then install node modules locally
cd /var/nodes/easyrtc
sudo npm install
-
Install Node.js
- Go to http://nodejs.org
- Click 'Install' to download the .msi file
- Run the Node.js installer
-
Create an EasyRTC application folder.
- Note: Node is defaulted to browse to
%HOMEDRIVE%%HOMEPATH%
- ex:
C:\Users\USERNAME\nodes\easyrtc
- Note: Node is defaulted to browse to
-
Download files from the server_example folder into your EasyRTC application folder.
-
In the start menu, launch the Node.js command prompt
-
Navigate to the easyrtc folder. There should be a server.js and package.json file.
- ex:
cd C:\Users\USERNAME\nodes\easyrtc
- ex:
-
Run the node package manager to download dependencies. This will create a new folder called node_modules
npm install
-
Install Node.js
- Go to http://nodejs.org
- Click 'Install' to download the .pkg file
- In the finder double-click on the pkg file to start the install
- By default node.js will be installed in /usr/local/bin/node and npm will be installed in /usr/local/bin/npm
- Make sure /usr/local/bin is in your $PATH variable (echo $PATH)
-
Download files from the server_example folder into a folder of your choice.
- OR download and extract this .zip
- ex:
/Users/USERNAME/nodes/easyrtc
-
Open a terminal window by double-clicking on Terminal within the Applications/Utilities directory in finder
-
Navigate to the easyrtc folder. There should be a server.js and package.json file.
- ex:
cd /Users/USERNAME/nodes/easyrtc
- ex:
-
Run the node package manager to download dependencies. This will create a new folder called node_modules
npm install
For EasyRTC maintainers or those wishing to test the newer beta release, a Git client can be used to download EasyRTC directly from our Github repository. Afterwards, EasyRTC can be updated using standard Git commands.
-
Follow install instructions for your OS
-
Delete the
easyrtc
folder from/node_modules/
-
From
/node_modules/
clone the EasyRTC repogit clone https://github.com/priologic/easyrtc.git
git clone -b beta https://github.com/priologic/easyrtc.git
-
In the console, enter the
/node_modules/easyrtc/
foldercd easyrtc
-
Install EasyRTC dependencies from NPM
npm install
Running the server from the console may be the best approach for development. It allows easy access to console messages which can alert you to problems and status.
- Open your console on the server.
- In Windows you can use the provided Node.js console program located in the Start Menu.
- Navigate to your EasyRTC application folder
- Run the server using the node command.
node server.js
Below is a small upstart script which can be saved as /etc/init/easyrtc.conf
description "EasyRTC Node.js server"
author "Priologic Software Inc."
# Saves log to /var/log/upstart/easyrtc.log
console log
# Starts only after drives are mounted.
start on started mountall
stop on shutdown
# Automatically Respawn. But fail permanently if it respawns 10 times in 5 seconds:
respawn
respawn limit 10 5
script
# Note: To run as a non root user, use exec sudo -u USERNAME node /var/nodes/easyrtc/server.js
exec /usr/bin/node /var/nodes/easyrtc/server.js
end script
This will start EasyRTC at boot and allow you to start and stop the service in the console using the following:
sudo start easyrtc
sudo stop easyrtc
There are improvements which can be made such as increasing the open file limit, running the service as a non-root user, and adding notification commands to let administrators know of problems.
If you are using the packaged version of EasyRTC, upgrading is easy. In the console change to your application directory then enter:
npm upgrade
Note that you should first check the changelog to see if there are any breaking changes.
Below is the initial server program which will run an EasyRTC server along with all the demos. This server program is also included within the EasyRTC download.
// Load required modules
var http = require("http"); // http server core module
var express = require("express"); // web framework external module
var io = require("socket.io"); // web socket external module
var easyrtc = require("easyrtc"); // EasyRTC external module
// Start Express http server on port 8080
var webServer = http.createServer(httpApp).listen(8080);
// Start Socket.io so it attaches itself to Express server
var socketServer = io.listen(webServer);
// Start EasyRTC server
var easyrtcServer = easyrtc.listen(httpApp, socketServer);
Configuration options are set using the setOption
function or from the listen()
function.
easyrtc.setOption('OPTION_NAME', 'OPTION_VALUE');
or
var easyrtcServer = easyrtc.listen(httpApp, socketServer, {'OPTION1_NAME': 'OPTION1_VALUE', 'OPTION2_NAME': 'OPTION2_VALUE'})
Note that some options can not be set after the listen()
function has been run.
For complete details, read server_configuration.md
Browsing EasyRTC should be a snap. If you have installed the server on your desktop machine with the default settings, you can browse to it by going to:
If the server is located on another computer, you can browse to it by knowing the IP address or domain name:
Please feel free to post on our discussion forum: