Fix an issue with the WebRTC service where it was impossible to join a channel once someone had left this channel

This commit is contained in:
Yann Flory
2016-03-14 14:49:19 +01:00
parent 06e5c84702
commit 77e7fb5724
4 changed files with 23 additions and 14 deletions

View File

@@ -9,6 +9,7 @@ var run = module.exports.run = function(server) {
socket.on('message', (data) => {
try {
let msg = JSON.parse(data)
console.log(msg);
if (msg.hasOwnProperty('key')) {
for (let master of server.clients) {
if (master.key === msg.key) {
@@ -32,6 +33,7 @@ var run = module.exports.run = function(server) {
socket.master = master
master.joiningClients.push(socket)
let id = master.joiningClients.length - 1
console.log(id);
master.send(JSON.stringify({id, data: msg.data}))
return
}