From bc92f77c95fdc3bf4ad08880250c7dc228250c82 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 2 Jun 2021 22:30:35 +0100 Subject: [PATCH] script: sse disconnection: Check the connecting status Don't produce an error if the browser is reconnecting. Hopefully it will be fine soon... Signed-off-by: Ian Jackson --- templates/script.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/templates/script.ts b/templates/script.ts index 54a258da..0d310d5c 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -2017,13 +2017,20 @@ function startup() { string_report_error('connection to server interrupted too long'); }); es.onerror = function(e) { - console.log('FOO',e,es); - json_report_error({ + let info = { updates_error : e, updates_event_source : es, updates_event_source_ready : es.readyState, update_oe : (e as any).className, - }) + }; + if (es.readyState == 2) { + json_report_error({ + reason: "TOTAL SSE FAILURE", + info: info, + }) + } else { + console.log('SSE error event', info); + } } recompute_keybindings(); space.addEventListener('mousedown', some_mousedown); -- 2.30.2