| | |
| | | package com.ard.sample.component.websocket.handler; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ard.sample.common.model.ResponseResult; |
| | | import com.ard.sample.component.websocket.enums.MessageType; |
| | | import com.ard.sample.component.websocket.model.Payload; |
| | | import com.ard.sample.component.websocket.model.WebSocketMessage; |
| | | import com.ard.sample.manage.service.IControlService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | |
| | | @Autowired |
| | | private LiveStreamHandler _liveStreamService; |
| | | |
| | | @Autowired |
| | | private IControlService _controlService; |
| | | |
| | | // 存储用户会话:userId -> WebSocketSession |
| | | private final Map<String, WebSocketSession> userSessions = new ConcurrentHashMap<>(); |
| | |
| | | if (userId != null) { |
| | | userSessions.remove(userId); |
| | | sessionLocks.remove(session); // 移除会话锁 |
| | | // 关闭远程调试模式,暂时写死sn,后续改为动态获取sn |
| | | ResponseResult responseResult = _controlService.controlDock("7CTDLCE00A1UPE","debug_mode_close",null); |
| | | log.info("关闭远程调试模式"); |
| | | if(responseResult.getCode() == ResponseResult.CODE_SUCCESS){ |
| | | log.info("关闭远程调试模式成功"); |
| | | } |
| | | // 清除该用户的所有订阅 |
| | | removeUserAllSubscriptions(userId); |
| | | //System.out.println("用户[" + userId + "]已断开连接,当前在线人数:" + userSessions.size()); |