mirror of
https://github.com/ianramzy/decentralized-video-chat.git
synced 2024-11-14 14:19:20 +08:00
removed debug code from server side code
This commit is contained in:
parent
64ef2b4196
commit
cd1cbe8112
18
server.js
18
server.js
@ -9,10 +9,6 @@ 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("http").createServer(app);
|
||||
var io = require("socket.io")(http);
|
||||
var path = require("path");
|
||||
@ -83,22 +79,8 @@ io.on("connection", function (socket) {
|
||||
var numClients = typeof clients !== "undefined" ? clients.length : 0;
|
||||
if (numClients === 0) {
|
||||
socket.join(room);
|
||||
twilio.tokens.create(function (err, response) {
|
||||
if (err) {
|
||||
logIt(err, room);
|
||||
} else {
|
||||
logIt("Token generated. Returning it to the browser client", room);
|
||||
socket.emit("token", response);
|
||||
// Existing callers initiates call with user
|
||||
}
|
||||
});
|
||||
} else if (numClients < 5) {
|
||||
socket.join(room);
|
||||
logIt("Connected clients", room);
|
||||
for (var clientId in clients.sockets) {
|
||||
logIt("ID: " + clientId, room);
|
||||
}
|
||||
|
||||
// When the client is not the first to join the room, all clients are ready.
|
||||
logIt("Broadcasting ready message", room);
|
||||
socket.broadcast.to(room).emit("willInitiateCall", socket.id, room);
|
||||
|
Loading…
Reference in New Issue
Block a user