Alert on websocket close

This commit is contained in:
Ruben van de Ven 2022-03-25 09:32:37 +01:00
parent 1e1cb5cfd0
commit 949a16b01f
1 changed files with 9 additions and 1 deletions

View File

@ -119,7 +119,7 @@ class Canvas {
this.setColor(this.colors[0]);
this.socket = new WebSocket(this.url);
this.socket = new WebSocket(this.url); // TODO: reconnectingwebsocket
this.socket.addEventListener('open', (e) => {
this.sendDimensions();
@ -150,6 +150,10 @@ class Canvas {
// this.openTheFloor()
}
});
this.socket.addEventListener('close', (e) => {
this.closeTheFloor();
alert('Internet connection seems to have problems. Please reload the page to reconnect.');
});
}
setPreloaded(json_url) {
@ -207,6 +211,10 @@ class Canvas {
this.wrapperEl.classList.remove('closed');
}
closeTheFloor() {
this.wrapperEl.classList.add('closed');
}
setFilename(filename) {
this.filename = filename;
this.filenameEl.innerText = filename;