svghmi/svghmi.js
author Edouard Tisserant
Thu, 19 Sep 2019 09:01:49 +0200
branchsvghmi
changeset 2780 e468f18df200
child 2783 5ee6967f721d
permissions -rw-r--r--
SVGHMI: moved static JS code to a separate file included at xhtml generation time
(function(){
    var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws');
    var ws = new WebSocket(relative_URI);
    ws.onmessage = function (evt) {
        var received_msg = evt.data;
        alert("Message is received..."+received_msg); 
    };
    ws.onopen = function (evt) {
        ws.send("test");
    };
})();