Browse Source

fix(气象监听): 修改接口正常使用

高家顺 3 years ago
parent
commit
ebb620cb49

+ 4 - 0
src/main/java/com/macro/mall/tiny/modules/business/controller/WebSocketServer.java

@@ -85,6 +85,10 @@ public class WebSocketServer {
         removeSensorMac();
         subOnlineCount();           //在线数减1
         redisMessageListenerContainer.removeMessageListener(subscribeListener);
+        subscribeListener = null;
+        if (WebSocketServer.onlineCount.get() == 0) {
+            initSensorMac();
+        }
         log.info("websocket有一连接关闭!当前在线人数为" + getOnlineCount());
     }