jinpengyong
2020-09-22 9125309788deca2a555c4f46c8491a950f8f0692
update
2 files modified
16 ■■■■ changed files
src/main/java/com/moral/webSocketServer/WebSocketServer.java 2 ●●● patch | view | raw | blame | history
src/main/webapp/view/newmap.jsp 14 ●●●● patch | view | raw | blame | history
src/main/java/com/moral/webSocketServer/WebSocketServer.java
@@ -114,7 +114,7 @@
        /**从安全Set中 移除当前连接对象*/
        webSocketSet.remove(this);
        try {
            channel.queueDelete("deviceInfo_" + accountId);
            //channel.queueDelete("deviceInfo_" + accountId);
            connection.close();
        } catch (IOException e) {
            log.error(e.getMessage());
src/main/webapp/view/newmap.jsp
@@ -367,7 +367,7 @@
<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();">--%>
@@ -709,18 +709,18 @@
                /*  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();
                }
                }*/
            };
            //关闭事件
            ws.onclose = function () {
                $("#close").html("websocket已经关闭");
                //$("#close").html("websocket已经关闭");
            };
            //发生了错误事件
            ws.onerror = function () {
                $("#close").html("websocket关闭错误");
                //$("#close").html("websocket关闭错误");
            };
        }
@@ -842,9 +842,9 @@
        } else if ("DeliverSensors" == methodName) {
            $("#close").html(methodName);
            moralMap.showSensors(jsonData);
        } else if ("CloseMq" == methodName) {
        } /*else if ("CloseMq" == methodName) {
            $("#close").html(methodName);
        }
        }*/
    }
</script>