function on_ws_msg(js) { console.log(js) //总电源数据显示 if (js.powert != undefined) { total_data = js.powert.total total_Infor(js, total_data) } //通道电源数据显示 if (js.powerc != undefined) { channel_power_infro = js.powerc channel_infro = channel_power_infro.power alarm = js.powerc.alarm channel_number = js.powerc.info channel_power = js.powerc.power j_data = js Channel_Info(j_data, channel_power_infro) threshold_mannage(js, channel_power_infro) //populateTable(j_data,channel_power) } if (js.alarmd != undefined) { // console.log(js.alarmd) // alarmd_data = js.alarmd // systemAlarm(alarmd_data) } } function ws_hdr() { var proto = window.location.protocol, ws; if (proto == 'https:') { ws = 'wss://'; } else { ws = 'ws://'; } return ws; } //ws = new WS('ws://'+window.location.host+'/ws',on_ws_msg); ws = new WS('ws://192.168.1.166/ws', on_ws_msg);