Don't show user as joined until they enter a key

This commit is contained in:
Alan Friedman 2016-01-16 11:08:32 -05:00
parent 83df79de29
commit fd84a4ef8d
2 changed files with 5 additions and 1 deletions

View File

@ -518,6 +518,7 @@ $(function() {
if (!key.length) return;
updateKeyVal(key);
$('#join-modal').modal('hide');
socket.emit('user joined');
}
$('#settings-modal').on('hide.bs.modal', function (e) {

View File

@ -40,12 +40,15 @@ class Room {
numUsers: this.numUsers,
users: this.users
});
});
socket.on('user joined', () => {
// echo globally (all clients) that a person has connected
socket.broadcast.emit('user joined', {
username: socket.username,
numUsers: this.numUsers,
users: this.users
});
});
});
// when the client emits 'typing', we broadcast it to others