Skip to content

Commit

Permalink
Some of Vincent's comments addressed, but the main comment about the …
Browse files Browse the repository at this point in the history
…use of the Shader is not addressed.
  • Loading branch information
jimver04 committed Feb 4, 2022
1 parent 79b4ed1 commit cff676f
Show file tree
Hide file tree
Showing 8 changed files with 396 additions and 69 deletions.
2 changes: 1 addition & 1 deletion dist/networked-aframe.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/networked-aframe.min.js

Large diffs are not rendered by default.

32 changes: 20 additions & 12 deletions docs/getting-started-local.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,31 +373,39 @@ I would love love love you to send me cool examples you've made, and I'm looking

--------

#Stopping NAF
#Permanent run NAF for Linux based servers

How to stop NAF ?
When you start NAF with `npm start` then the Process generated is contextualized with the terminal window, i.e. if you close the window or restart the server, the process stops.

In order to have NAF running in your linux server permantently, i.e. to avoid the aforementioned misshappenings then you should use pm2 in order to convert node NAF server in a daemon service.
PM2 is a Production Process Manager for Node.js applications with a built-in Load Balancer (http://pm2.io/).

As you have observed there is no stop command. If you are in a Linux based server, e.g. Ubuntu, try the following commands to Find and Kill (the process that you have initiated for NAF).
Steps
- Install PM2

**1. Find**
`$ sudo npm install -g pm2`

`sudo lsof -i:8080`
- Go to /server folder and start easyrtc-server.js as a service with pm2

`$ pm2 start easyrtc-server.js -i 4`

With this command you find where node server listens (change 8080 to whatever port you use)
Note that `-i 4` sets as maximum 4 instances of NAF at your server which can significantly improve performance when many players enter.

This comment has been minimized.

Copy link
@vincentfretin

vincentfretin Feb 4, 2022

Member

Are you sure this is working properly? All participants of a given room needs to go to the same nodejs process, otherwise you will have parallel rooms, unless you use socketio with redis so that a message received is broadcasted to all nodejs processes.


Then you will get a big report that has also a line beginning with **node**

`COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Monitor:

node 3766 JohnSmith 20u IPv4 27606 0t0 TCP *:8080 (LISTEN)`
`$ pm2 monitor`

Make pm2 auto-boot at server restart:

You want the second field namely ProcessID which happens for me to be 3766 but for you will be another number
`$ pm2 startup`


**2. Kill**
#Stopping NAF when started with pm2

How to stop NAF ?

**sudo kill -9 3766**
`pm2 stop easyrtc-server.js`



21 changes: 11 additions & 10 deletions examples/advanced-video-green-screen.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@

</head>
<body>
<a-scene networked-scene="
<a-scene stats networked-scene="
room: basic-multi-stream-green-screen;
debug: true;
adapter: easyrtc;
audio: true;
video: true;
video: false;
">

<a-assets>

<img id="grid" src="https://img.gs/bbdkhfbzkk/stretch/https://i.imgur.com/25P1geh.png" crossorigin="anonymous">
<img id="sky" src="https://i.imgur.com/WqlqEkq.jpg" crossorigin="anonymous" />

Expand Down Expand Up @@ -63,9 +64,9 @@
</a-entity>

<!-- Grid -->
<a-entity position="0 0 0"
geometry="primitive: plane; width: 10000; height: 10000;" rotation="-90 0 0"
material="src: #grid; repeat: 10000 10000; transparent: true; metalness:0.6; roughness: 0.4; sphericalEnvMap: #sky;"></a-entity>
<!-- <a-entity position="0 0 0"-->
<!-- geometry="primitive: plane; width: 10000; height: 10000;" rotation="-90 0 0"-->
<!-- material="src: #grid; repeat: 10000 10000; transparent: true; metalness:0.6; roughness: 0.4; sphericalEnvMap: #sky;"></a-entity>-->

<!-- Lights -->
<a-entity light="color: #ccccff; intensity: 1; type: ambient;" visible=""></a-entity>
Expand Down Expand Up @@ -196,11 +197,11 @@
// Called by Networked-Aframe when connected to server
function onConnect () {
console.log("onConnect", new Date());
setTimeout(function(){
// This is the processed stream that we want to send
// We do not want the default stream camera (takes bandwidth)
NAF.connection.adapter.enableCamera(false);
},5000);
// setTimeout(function(){
// // This is the processed stream that we want to send
// // We do not want the default stream camera (takes bandwidth)
// // NAF.connection.adapter.enableCamera(false);
// },5000);

// Handle screen button click (Off and On)
screenBtnEle.addEventListener('click', function() {
Expand Down

0 comments on commit cff676f

Please sign in to comment.