Alert on websocket close
This commit is contained in:
parent
1e1cb5cfd0
commit
949a16b01f
1 changed files with 9 additions and 1 deletions
|
@ -119,7 +119,7 @@ class Canvas {
|
||||||
this.setColor(this.colors[0]);
|
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.socket.addEventListener('open', (e) => {
|
||||||
this.sendDimensions();
|
this.sendDimensions();
|
||||||
|
|
||||||
|
@ -150,6 +150,10 @@ class Canvas {
|
||||||
// this.openTheFloor()
|
// 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) {
|
setPreloaded(json_url) {
|
||||||
|
@ -207,6 +211,10 @@ class Canvas {
|
||||||
this.wrapperEl.classList.remove('closed');
|
this.wrapperEl.classList.remove('closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeTheFloor() {
|
||||||
|
this.wrapperEl.classList.add('closed');
|
||||||
|
}
|
||||||
|
|
||||||
setFilename(filename) {
|
setFilename(filename) {
|
||||||
this.filename = filename;
|
this.filename = filename;
|
||||||
this.filenameEl.innerText = filename;
|
this.filenameEl.innerText = filename;
|
||||||
|
|
Loading…
Reference in a new issue