Skip to content

Commit

Permalink
✨ Add new socket.io event. KamandPrompt#140
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeconias authored and LalitNM committed Oct 19, 2020
1 parent 37a672f commit 7304636
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion public/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ const appendContentInfo = (room_name, online, data_joined) => {
$('.app-container').append($contentInfo);
}

socket.on('user invalid', (data) => {
if(data === "This user name is invalid.") {
nameError = document.getElementById('nicknameError');
nameError.innerHTML = data;
}
})

//if server emits user exists, propmt for changing username
socket.on('user exists', (data) => {
nameError = document.getElementById('nicknameError');
Expand All @@ -132,7 +139,6 @@ socket.on('user set', (data) => {
});

//notifies users that someone joined baat-cheet

socket.on('user joined', function(data) {
notify(data.username + " just joined", "info");
$("#lobby-msg").find('.top').find('span')[1].innerHTML = data.online + " user(s) online";
Expand Down

0 comments on commit 7304636

Please sign in to comment.