chiark / gitweb /
script: sse disconnection: Check the connecting status
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 2 Jun 2021 21:30:35 +0000 (22:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 2 Jun 2021 22:32:10 +0000 (23:32 +0100)
Don't produce an error if the browser is reconnecting.  Hopefully it
will be fine soon...

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index 54a258da5356b79ad3370481d2188c0d4d4d7087..0d310d5cefbd5da1706a9e2455628bb76bf7eb3a 100644 (file)
@@ -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);