Skip to content

Latest commit

 

History

History
executable file
·
169 lines (114 loc) · 4.36 KB

installation-guide.md

File metadata and controls

executable file
·
169 lines (114 loc) · 4.36 KB

Installation Guide

This page explains how to install RTCMultiConnection.

Fetch from Github

Github is strongly recommended. NPM or TAR are secondary options.

git clone https://github.com/muaz-khan/RTCMultiConnection.git ./
npm install

Or download ZIP:

wget https://github.com/muaz-khan/RTCMultiConnection/archive/master.zip
unzip master.zip

Then call npm install.

Install using NPM or Bower

npm install rtcmulticonnection

# or
bower install rtcmulticonnection

Run server.js

# install all required packages first
npm install

# then run the server
node server.js

Now open http://localhost:9001/.

Modify config.json

{
  "socketURL": "/",
  "socketMessageEvent": "abcdef",
  "socketCustomEvent": "ghijkl",
  "port": "443",
  "enableLogs": "false",
  "autoRebootServerOnFailure": "false",
  "isUseHTTPs": "true",
  "ssl_key": "/ssl/certificate.key",
  "ssl_cert": "/ssl/certificate.crt",
  "ssl_cabundle": "/ssl/certificate.cabundle"
}

Now run server.js and it will automatically use above configuration.

How to check if server is running correctly?

Open this URL: https://localhost:9001/socket.io/socket.io.js

If you can load /socket.io/socket.io.js on your server then it is working fine.

Stop Old Processes

Check all processes running on port 9001 and stop process by id:

lsof -n -i4TCP:9001 | grep LISTEN
kill process-ID

Or stop all processes on a specific port. (It may require sudo privileges):

fuser -vk 9001/tcp

Now open: http://localhost:9001/

Keep running server in background using pm2

``sh npm install pm2 -g pm2 startup
pm2 start server.js pm2 save


Now `server.js` will auto restart on failure. Even auto run as soon as operating system reboots.

For more info about `pm2` please check [this link](https://github.com/Unitech/pm2).

## Keep running server in background usnig `nohup`

```sh
nohup nodejs server.js > /dev/null 2>&1 &

Or:

nohup nodejs server.js &

Or use forever:

npm install forever -g
forever start server.js

To auto-start server.js on system-reboot (i.e. when Mac/Linux system shuts down or reboots):

npm install forever-service

cd __path to your npm install__
forever-service install ncustomAppName --script server.js

Commands to interact with service ncustomAppName Start:

- "sudo service ncustomAppName start" Stop
- "sudo service ncustomAppName stop" Status
- "sudo service ncustomAppName status" Restart - "sudo service ncustomAppName restart"

More info about forever-service here.

Heroku

If you are installing on heroku, please make sure to enable following config variables:

  1. NODE_MODULES_CACHE:false
  2. NPM_CONFIG_PRODUCTION:false
  3. YARN_PRODUCTION:false

You can set above variables through heroku CLI as well:

heroku config:set NPM_CONFIG_PRODUCTION=false YARN_PRODUCTION=false NODE_MODULES_CACHE=false

Other Documents

  1. Getting Started guide for RTCMultiConnection
  2. Installation Guide
  3. How to Use?
  4. API Reference
  5. Upgrade from v2 to v3
  6. How to write iOS/Android applications?
  7. Tips & Tricks

License

RTCMultiConnection is released under MIT licence . Copyright (c) Muaz Khan.