# HG changeset patch
# User Edouard Tisserant
# Date 1668500570 -3600
# Node ID 20f9f0c36ad681091696d418f01bd74cd9ada44c
# Parent  7e8db0b44e42df4aa4b0fe2284305e04f767a22c
SVGHMI: do not try to reconnect websocket if closed properly by server.

diff -r 7e8db0b44e42 -r 20f9f0c36ad6 svghmi/svghmi.js
--- a/svghmi/svghmi.js	Wed Nov 09 12:14:35 2022 +0100
+++ b/svghmi/svghmi.js	Tue Nov 15 09:22:50 2022 +0100
@@ -637,6 +637,13 @@
     ws = null;
     // reconect
     // TODO : add visible notification while waiting for reload
+    console.log(evt.wasClean)
+    console.log(evt.reason)
+    if(evt.code=1000){
+        // Do not attempt to reconnect immediately in case of Normal Closure
+        window.alert("Connection closed by server");
+        location.reload();
+    }
     window.setTimeout(create_ws, reconnect_delay);
     reconnect_delay += 500;
 };