diff -r 86a572fb05f8 -r 2ed9ff826d03 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Fri Sep 27 06:54:35 2019 +0200 +++ b/svghmi/gen_index_xhtml.xslt Mon Sep 30 13:26:11 2019 +0200 @@ -46,22 +46,52 @@ } + // svghmi.js + + + (function(){ - var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws'); + // Open WebSocket to relative "/ws" address - var ws = new WebSocket(relative_URI); + 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; + // TODO : check for hmitree hash header + + // if not matching, reload page + 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 + + + + + + // TODO : prefix with hmitree hash header + ws.send("test"); };