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; if (!key.length) return;
updateKeyVal(key); updateKeyVal(key);
$('#join-modal').modal('hide'); $('#join-modal').modal('hide');
socket.emit('user joined');
} }
$('#settings-modal').on('hide.bs.modal', function (e) { $('#settings-modal').on('hide.bs.modal', function (e) {

View File

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