WebRTC socket.io signaller
websocket based signaller for handling webrtc offer answer handshake for a comm SaaS platform
To start signaller socket.io server
Signaller to mange the SDP offer/answer for webrtc app on socket.io. To be used while deploying - webrtcdevelopment https://github.com/altanai/webrtc/
Get the code
Download the npm module
npm i webrtcdevelopment_signaller
or Clone from the git repo
git clone git@github.com:altanai/webrtcsignaller.git
Integrate inside nodejs applications
One the source is download import the server lib and start the server
Recommended node version >=v612 Can manage node versions using nvm / node version manager
curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bashsource ~/.profile
check nvm version
nvm --versionnvm list
To install a specific node version
vm install v6.2.1Downloading https://nodejs.org/dist/v6.2.1/node-v6.2.1-linux-x64.tar.xz...######################################################################## 100.0% WARNING: checksums are currently disabled
check updated node verson
node -vv6.2.1
Starting manually
To start signaller socket.io server
node server --ssl --port=8085
Start server with forever
First download forever
npm install forever -g
start forever with options secure server and port
forever start server.js --ssl --port=8085
start with pm2 process manager
start using the ecosystem config file
~/webrtcsignaller$ pm2 start ecosystem.config.js [PM2][WARN] Applications signaller not running, starting...[PM2] App [signaller] launched ┌─────┬──────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │├─────┼──────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤│ 0 │ signaller │ default │ 2.0.0 │ cluster │ 30115 │ 0s │ 0 │ online │ 0% │ 14.3mb │ ubuntu │ enabled │└─────┴──────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
see status of running apps
pm2 list┌─────┬──────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │├─────┼──────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤│ 0 │ signaller │ default │ 2.0.0 │ cluster │ 30115 │ 3s │ 0 │ online │ 0% │ 31.8mb │ ubuntu │ enabled │└─────┴──────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
to see the process reports
pm2 reprt
Further more check if ports are listening
lsof -i | grep 8085> PM2 21865 ubuntu 31u IPv4 18120035 0t0 TCP *:8085
to see list of running processes in forever
forever list
Generate CSR for ssl certs
openssl req -nodes -newkey rsa:2048 -keyout brightchats.key -out brightchat.csr
Then upload the CSR in ssl providing websites like go addy and either generate or re-key the certs
Help and Debugging
nodejs help
To see system usage
df -h> Filesystem Size Used Avail Use% Mounted onudev 492M 12K 492M 1% /devtmpfs 100M 376K 99M 1% /run/dev/xvda1 7.8G 5.9G 1.6G 80% /none 4.0K 0 4.0K 0% /sys/fs/cgroupnone 5.0M 0 5.0M 0% /run/locknone 497M 0 497M 0% /run/shmnone 100M 0 100M 0% /run/user
to see free memory
free -m total used free shared buffers cachedMem: 992 841 151 17 64 325-/+ buffers/cache: 450 541Swap: 0 0 0
checking avaible CPU cores
grep -c ^processor /proc/cpuinfo> 1
To see help related to server
node server.js --helpYou can manage configuration in the "config.json" file.Or use following commands: node server.js node server.js --port=9002 node server.js --port=9002 --ssl node server.js --port=9002 --ssl --sslKey=/home/ssl/ssl.key --sslCert=/home/ssl/ssl.crt Here is list of all config parameters:--port=80 This parameter allows you set any custom port.--ssl This parameter is shortcut
Reporting a Vulnerability
Create an issues https://github.com/altanai/webrtc/issues https://github.com/altanai/webrtc/issues
License
MIT
SSH into remote server
Issue1 Permission denied (publickey).
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WARNING: UNPROTECTED PRIVATE KEY FILE! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Permissions 0644
solution create a instance for example ec2 instance on AWS and create a ssh key. change the ownership permission for the key and the ssh using it
chmod 600 key.pemssh -v -i key.pem ubuntu@ec2-address