|  |  |  | 
|---|
|  |  |  | <body> | 
|---|
|  |  |  | <div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <%--<textarea id="close" hidden></textarea>--%> | 
|---|
|  |  |  | <textarea id="close" hidden></textarea> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="main_body"> | 
|---|
|  |  |  | <%--<input  id="button" type="button" value="点击" onclick="getJs();">--%> | 
|---|
|  |  |  | 
|---|
|  |  |  | /*  if (moralMap.showSensors && typeof (moralMap.showSensors) == "function") { | 
|---|
|  |  |  | moralMap.showSensors(JSON.parse(JSON.parse(msg.data))); | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  | /*if ($("#close").html() == "CloseMq") { | 
|---|
|  |  |  | if ($("#close").html() == "CloseMq") { | 
|---|
|  |  |  | ws.close(); | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  | } | 
|---|
|  |  |  | moralMap.showSensors(JSON.parse(JSON.parse(msg.data))); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //关闭事件 | 
|---|
|  |  |  | ws.onclose = function () { | 
|---|
|  |  |  | //$("#close").html("websocket已经关闭"); | 
|---|
|  |  |  | $("#close").html("websocket已经关闭"); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | //发生了错误事件 | 
|---|
|  |  |  | ws.onerror = function () { | 
|---|
|  |  |  | //$("#close").html("websocket关闭错误"); | 
|---|
|  |  |  | $("#close").html("websocket关闭错误"); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | })(jQuery); | 
|---|
|  |  |  | 
|---|
|  |  |  | } else if ("RefreshState" == methodName) { | 
|---|
|  |  |  | var states = jsonData.states; | 
|---|
|  |  |  | moralMap.refreshState(states); | 
|---|
|  |  |  | } else if ("DeliverSensors" == methodName) { | 
|---|
|  |  |  | } else if ("CloseMq" == methodName) { | 
|---|
|  |  |  | $("#close").html(methodName); | 
|---|
|  |  |  | moralMap.showSensors(jsonData); | 
|---|
|  |  |  | } /*else if ("CloseMq" == methodName) { | 
|---|
|  |  |  | $("#close").html(methodName); | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </script> | 
|---|