lots of changes to switch to vue

This commit is contained in:
Zutatensuppe 2021-05-13 22:45:55 +02:00
parent 5adb8806dc
commit a0118b0bdf
22 changed files with 582 additions and 920 deletions

View file

@ -2,6 +2,8 @@
import Time from '../common/Time.js'
const CODE_CUSTOM_DISCONNECT = 4000
/**
* Wrapper around ws that
* - buffers 'send' until a connection is available
@ -57,8 +59,16 @@ export default class WsWrapper {
}
ws.onclose = (e) => {
this.handle = null
this.reconnectTimeout = setTimeout(() => { this.connect() }, 1 * Time.SEC)
if (e.code !== CODE_CUSTOM_DISCONNECT) {
this.reconnectTimeout = setTimeout(() => { this.connect() }, 1 * Time.SEC)
}
this.onclose(e)
}
}
disconnect() {
if (this.handle) {
this.handle.close(CODE_CUSTOM_DISCONNECT)
}
}
}