diff --git a/static/sfu.js b/static/sfu.js index 061cfff..01b99ff 100644 --- a/static/sfu.js +++ b/static/sfu.js @@ -650,11 +650,6 @@ function addToChatbox(peerId, nick, message, me){ function handleInput() { let username = getUsername(); - if(!username) { - displayError("Sorry, you're anonymous, you cannot chat"); - return; - } - let input = document.getElementById('input'); let data = input.value; input.value = ''; @@ -723,6 +718,11 @@ function handleInput() { me = false; } + if(!username) { + displayError("Sorry, you're anonymous, you cannot chat"); + return; + } + addToChatbox(myid, username, message, me); send({ type: 'chat',