svghmi/svghmi.js
branchsvghmi
changeset 2783 5ee6967f721d
parent 2780 e468f18df200
child 2788 2ed9ff826d03
--- a/svghmi/svghmi.js	Thu Sep 19 15:32:36 2019 +0200
+++ b/svghmi/svghmi.js	Fri Sep 20 13:38:58 2019 +0200
@@ -1,11 +1,22 @@
+// svghmi.js
+
 (function(){
-    var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws');
-    var ws = new WebSocket(relative_URI);
+    // Open WebSocket to relative "/ws" address
+    var ws = new WebSocket(window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws'));
+
+    // Register message reception handler 
     ws.onmessage = function (evt) {
+        // TODO : dispatch and cache hmi tree updates
+
         var received_msg = evt.data;
         alert("Message is received..."+received_msg); 
     };
+
+    // Once connection established
     ws.onopen = function (evt) {
+        // TODO : enable the HMI (was previously offline, or just starts)
+        //        show main page
+
         ws.send("test");
     };
 })();