use assets from the vanilla repo

This commit is contained in:
Lee
2023-12-30 22:43:38 +00:00
parent 1663a127cc
commit 6fd5fdb7fe
6 changed files with 32 additions and 36 deletions

View File

@ -19,7 +19,7 @@ export class SocketManager {
// The backend will automatically push data once connected
this._webSocket.onopen = () => {
this._app.caption.set('Caricamento...')
this._app.caption.set('Loading...')
// Reset reconnection scheduling since the WebSocket has been established
this._reconnectDelayBase = 0
@ -33,9 +33,9 @@ export class SocketManager {
// See https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
// Treat other codes as active errors (besides connectivity errors) when displaying the message
if (event.code === 1006) {
this._app.caption.set('Connessione persa!')
this._app.caption.set('Lost connection!')
} else {
this._app.caption.set('Disconnesso per un errore.')
this._app.caption.set('Disconnected due to error.')
}
// Schedule socket reconnection attempt
@ -152,14 +152,14 @@ export class SocketManager {
clearInterval(reconnectInterval)
// Update displayed text
this._app.caption.set('Riconnessione...')
this._app.caption.set('Reconnecting...')
// Attempt reconnection
// Only attempt when reconnectDelaySeconds === 0 and not <= 0, otherwise multiple attempts may be started
this.createWebSocket()
} else if (this._reconnectDelaySeconds > 0) {
// Update displayed text
this._app.caption.set(`Riconnessione in ${this._reconnectDelaySeconds}s...`)
this._app.caption.set(`Reconnecting in ${this._reconnectDelaySeconds}s...`)
}
}, 1000)
}