svghmi/svghmi.js
author Edouard Tisserant
Thu, 19 Sep 2019 10:41:39 +0200
branchsvghmi
changeset 2781 fbdd0fd8ee4f
parent 2780 e468f18df200
child 2783 5ee6967f721d
permissions -rw-r--r--
SVGHMI: gui.svg -> svghmi.svg
(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");
    };
})();