Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send "ready" twice in step-06 #85

Open
lxlenovostar opened this issue May 28, 2018 · 1 comment · May be fixed by #89
Open

send "ready" twice in step-06 #85

lxlenovostar opened this issue May 28, 2018 · 1 comment · May be fixed by #89

Comments

@lxlenovostar
Copy link

  socket.on('create or join', function(room) {
    log('Received request to create or join room ' + room);

    var clientsInRoom = io.sockets.adapter.rooms[room];
    var numClients = clientsInRoom ? Object.keys(clientsInRoom.sockets).length : 0;
    log('Room ' + room + ' now has ' + numClients + ' client(s)');

    if (numClients === 0) {
      socket.join(room);
      log('Client ID ' + socket.id + ' created room ' + room);
      socket.emit('created', room, socket.id);
    } else if (numClients === 1) {
      log('Client ID ' + socket.id + ' joined room ' + room);
      // io.sockets.in(room).emit('join', room);
      socket.join(room);
      socket.emit('joined', room, socket.id);
      io.sockets.in(room).emit('ready', room);
      //socket.broadcast.emit('ready', room);
    } else { // max two clients
      socket.emit('full', room);
    }
  });

In index.js, send "ready" twice will let peer createOffer() twice. This will make a error.

@nitobuendia
Copy link
Contributor

Hi @lxlenovostar Thanks a lot for reporting.

While I have not tested it, I can see how emitting ready twice could be an issue. This feels the same root cause as #87 and there is a fix proposed there. We will be tackling it shortly.

@druuu druuu linked a pull request Jun 15, 2018 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants