svghmi/svghmi.js
branchsvghmi
changeset 3268 d22782b9591f
parent 3206 4fd7bd10e606
child 3299 8b45d8494fae
equal deleted inserted replaced
3267:5f20f391ae31 3268:d22782b9591f
    28         }
    28         }
    29     });
    29     });
    30 };
    30 };
    31 
    31 
    32 // Open WebSocket to relative "/ws" address
    32 // Open WebSocket to relative "/ws" address
    33 var ws = new WebSocket(window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws'));
    33 
       
    34 var ws_url = 
       
    35     window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws')
       
    36     + '?mode=' + (window.location.hash == "#watchdog" 
       
    37                   ? "watchdog"
       
    38                   : "multiclient");
       
    39 var ws = new WebSocket(ws_url);
    34 ws.binaryType = 'arraybuffer';
    40 ws.binaryType = 'arraybuffer';
    35 
    41 
    36 const dvgetters = {
    42 const dvgetters = {
    37     INT: (dv,offset) => [dv.getInt16(offset, true), 2],
    43     INT: (dv,offset) => [dv.getInt16(offset, true), 2],
    38     BOOL: (dv,offset) => [dv.getInt8(offset, true), 1],
    44     BOOL: (dv,offset) => [dv.getInt8(offset, true), 1],