Allow server to push error message to client.

This commit is contained in:
Juliusz Chroboczek
2020-04-25 02:09:11 +02:00
parent 2cb323ec31
commit cb1782b6b2
2 changed files with 36 additions and 19 deletions
+3 -1
View File
@@ -311,6 +311,9 @@ function serverConnect() {
case 'chat':
addToChatbox(m.id, m.username, m.value, m.me);
break;
case 'error':
displayError(m.message);
break;
default:
console.warn('Unexpected server message', m.type);
return;
@@ -773,7 +776,6 @@ document.getElementById('disconnectbutton').onclick = function(e) {
socket.close();
}
function start() {
group = decodeURIComponent(location.pathname.replace(/^\/[a-z]*\//, ''));
let title = document.getElementById('title');