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":
logIt("connected");
// Once connected we no longer have a need for the signaling server, so disconnect
VideoChat.socket.off("token");
VideoChat.socket.off("offer");
// VideoChat.socket.off("token");
// VideoChat.socket.off("offer");
break;
case "disconnected":
logIt("disconnected");
@ -308,13 +308,6 @@ var VideoChat = {
// Send ice candidate over websocket
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

View File

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