upstream backendEasyRTC {
server 127.0.0.1:9080;
}
In the server section:
location /socket.io {
#proxy_pass http: // 127.0.0.1:9080;
proxy_pass http: // backendEasyRTC;
proxy_http_version 1.1;
proxy_set_header Upgrade $ http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $ host;
}
easyRTC.webSocket = io.connect ('http: // your server');
config.httpPort = 9080;
<script src = "/ socket.io/socket.io.js"> </ script> <script type = "text / javascript" src = "/ static / js / easyrtc.js"> </ script>
<video autoplay = "autoplay" id = "remoteVideo1"> </ video> <video autoplay = "autoplay" id = "remoteVideo2"> </ video>
<video autoplay = "autoplay" id = "localVideo" muted = "muted" volume = "0"> </ video>
var maxCALLERS = 3; // Number of people in the room
window.onload - function () {
easyRTC.setLoggedInListener (callEverybodyElse); // Fires when a new webrtc stream appears.
easyRTC.initManaged ("myroom", "localVideo", ["remoteVideo1", "remoteVideo2], loginSuccess);
// myroom - the name of the room where users will be
// localVideo - your video
// ["remoteVideo1", "remoteVideo2] - where to output remote user streams.
// loginSuccess - in it you can find your thread id
}
function loginSuccess (easyRTCId) {
console.log ('My id' + easyRTCId); // Useful for further user identification
}
function callEverybodyElse (otherPeople) {
easyRTC.setLoggedInListener (null);
var list = [];
var connectCount = 0;
for (var i in otherPeople) {
list.push (i);
}
// By default, the new stream is the last in the array
function establishConnection (position) {
function callSuccess () {
connectCount ++;
if (connectCount <maxCALLERS && position> 0) {
establishConnection (position-1);
}
}
function callFailure () {
easyRTC.showError ("CALL-REJECTED", "Rejected by other party");
if (connectCount <maxCALLERS && position> 0) {
establishConnection (position-1);
}
}
easyRTC.call (list [position], callSuccess, callFailure);
}
if (list.length> 0) {
establishConnection (list.length-1);
}
}
easyRTC.setSocketUrl (": 9088");
easyRTC.setVideoBandwidth (40);
easyRTC.setVideoDims (320,180); - video resolution
Source: https://habr.com/ru/post/436928/