IT WORKS WITH THREE CLIENTS ON LOCALHOST

This commit is contained in:
Khush Jammu 2020-05-30 17:05:05 +08:00
parent 4ab12e3e66
commit 90ec6f2fb9
2 changed files with 8 additions and 14 deletions

View File

@ -183,8 +183,8 @@ var VideoChat = {
case "connected": case "connected":
logIt("connected"); logIt("connected");
// Once connected we no longer have a need for the signaling server, so disconnect // Once connected we no longer have a need for the signaling server, so disconnect
VideoChat.socket.off("token"); // VideoChat.socket.off("token");
VideoChat.socket.off("offer"); // VideoChat.socket.off("offer");
break; break;
case "disconnected": case "disconnected":
logIt("disconnected"); logIt("disconnected");
@ -308,13 +308,6 @@ var VideoChat = {
// Send ice candidate over websocket // Send ice candidate over websocket
VideoChat.socket.emit("candidate", JSON.stringify(candidate), roomHash, uuid); VideoChat.socket.emit("candidate", JSON.stringify(candidate), roomHash, uuid);
}); });
// Reset the buffer of local ICE candidates. This is not really needed, but it's good practice
// VideoChat.localICECandidates[uuid] = [];
// } else {
// console.log("attemped to run onAnswer on UUID ", uuid, " which already happened");
// }
}, },
// Called when a stream is added to the peer connection // Called when a stream is added to the peer connection

View File

@ -9,10 +9,11 @@ var twilio = require("twilio")(twillioAccountSID, twillioAuthToken);
var express = require("express"); var express = require("express");
var app = express(); var app = express();
const fs = require('fs'); const fs = require('fs');
var http = require("https").createServer({ // var http = require("https").createServer({
key: fs.readFileSync('/Users/khushjammu/certs/privkey.pem'), // key: fs.readFileSync('/Users/khushjammu/certs/privkey.pem'),
cert: fs.readFileSync('/Users/khushjammu/certs/cert.pem') // cert: fs.readFileSync('/Users/khushjammu/certs/cert.pem')
}, app); // }, app);
var http = require("http").createServer(app);
var io = require("socket.io")(http); var io = require("socket.io")(http);
var path = require("path"); var path = require("path");
var public = path.join(__dirname, "public"); var public = path.join(__dirname, "public");
@ -144,7 +145,7 @@ io.on("connection", function (socket) {
}); });
// Listen for Heroku port, otherwise just use 3000 // Listen for Heroku port, otherwise just use 3000
var port = process.env.PORT || 443; var port = process.env.PORT || 3000;
http.listen(port, function () { http.listen(port, function () {
console.log("http://localhost:" + port); console.log("http://localhost:" + port);
}); });