jiazx0107@163.com
2023-10-26 57ce50108ffe8d85f9508529dbffea0c064c44a2
src/main/java/com/fzzy/gateway/hx2023/websocket/WebSocketDeviceLed.java
@@ -1,7 +1,7 @@
package com.fzzy.gateway.hx2023.websocket;
import com.alibaba.fastjson.JSONObject;
import com.fzzy.gateway.hx2023.ScConstant;
import com.fzzy.gateway.GatewayUtils;
import com.fzzy.gateway.hx2023.data.WebSocketPacket;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@@ -13,8 +13,9 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
 *
 * 网关接受系统发送的报文信息
 */
@Slf4j
@Component
@@ -42,7 +43,7 @@
        sessionPool.put(key, session);
        sessionIds.put(session.getId(), key);
        ScConstant.updateOnline(deviceId);
        GatewayUtils.updateOnline(deviceId);
        log.info("new webSocket,clientId={}", key);
    }
@@ -57,7 +58,7 @@
        String deviceId = key.substring(0, key.indexOf("-"));
        ScConstant.updateOffOnline(deviceId);
        GatewayUtils.updateOffOnline(deviceId);
        log.info("WebSocket连接关闭={}", key);
@@ -84,7 +85,7 @@
        String deviceId = key.substring(0, key.indexOf("-"));
        ScConstant.updateOffOnline(deviceId);
        GatewayUtils.updateOffOnline(deviceId);
        sessionPool.remove(key);
        sessionIds.remove(session.getId());
@@ -113,6 +114,4 @@
            }
        }
    }
}