From 4dc36b6fdd282be20284bf44dbb6144fb8bbdfb0 Mon Sep 17 00:00:00 2001 From: Jeconias Santos Date: Sun, 18 Oct 2020 23:54:55 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20new=20socket.io=20event.=20#1?= =?UTF-8?q?40?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/client.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/client.js b/public/client.js index dec8b4e..8a4aaf6 100644 --- a/public/client.js +++ b/public/client.js @@ -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'); @@ -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";