feature: OliveTin now relies on websocket, and will show a big error if it isn't available (#323)

* feature: OliveTin now relies on websocket, and will show a big error if it isnt available

* feature: OliveTin now relies on websocket, and will show a big error if it isnt available
This commit is contained in:
James Read
2024-05-26 19:21:54 +01:00
committed by GitHub
parent c70cc864ee
commit daa48b5a73
3 changed files with 31 additions and 16 deletions

View File

@@ -1,3 +1,7 @@
import {
refreshServerConnectionLabel
} from './marshaller.js'
window.ws = null
export function checkWebsocketConnection () {
@@ -34,6 +38,8 @@ function websocketOnOpen (evt) {
window.ws.send('monitor')
refreshServerConnectionLabel()
window.refreshLoop()
}
@@ -58,9 +64,15 @@ function websocketOnMessage (msg) {
function websocketOnError (err) {
window.websocketAvailable = false
window.refreshLoop()
console.error(err)
console.log(err)
window.showBigError('ws-connect-error', 'connecting to the websocket', 'Please see your browser console for debugging information.', true)
refreshServerConnectionLabel()
}
function websocketOnClose () {
window.websocketAvailable = false
refreshServerConnectionLabel()
}