| | |
| | | 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; |
| | |
| | | sessionPool.put(key, session); |
| | | sessionIds.put(session.getId(), key); |
| | | |
| | | ScConstant.updateOnline(deviceId); |
| | | GatewayUtils.updateOnline(deviceId); |
| | | |
| | | log.info("new webSocket,clientId={}", key); |
| | | } |
| | |
| | | |
| | | String deviceId = key.substring(0, key.indexOf("-")); |
| | | |
| | | ScConstant.updateOffOnline(deviceId); |
| | | GatewayUtils.updateOffOnline(deviceId); |
| | | |
| | | log.info("WebSocket连接关闭={}", key); |
| | | |
| | |
| | | |
| | | String deviceId = key.substring(0, key.indexOf("-")); |
| | | |
| | | ScConstant.updateOffOnline(deviceId); |
| | | GatewayUtils.updateOffOnline(deviceId); |
| | | |
| | | sessionPool.remove(key); |
| | | sessionIds.remove(session.getId()); |