function on_ws_msg(bin){ ip_data() var j = BIN.hdr.b2j(bin); console.log(j) //总电源数据显示 if (j.powert != undefined){ total_data = j.powert.total total_Infor(j,total_data) } //通道电源数据显示 if(j.powerc != undefined){ channel_power_infro = j.powerc channel_infro = channel_power_infro.power threshold = j.powerc.thr alarm = j.powerc.alarm channel_number = j.powerc.info channel_power = j.powerc.power j_data = j Channel_Info(j_data,channel_power_infro) //threshold_mannage(j,channel_power_infro,threshold) //populateTable(j_data,channel_power) } if(j.alarmd != undefined) { alarmd_data = j.alarmd systemAlarm(alarmd_data) } } function ws_hdr(){ var proto = window.location.protocol,ws; if (proto == 'https:'){ ws = 'wss://'; }else{ ws = 'ws://'; } return ws; } function ip_data() { ip_href = window.location.href } ws = new WS('ws://192.168.234.132/ws',on_ws_msg);