From ae6cf3e11a1d05b38dc8c18af1d211839b2ff7b6 Mon Sep 17 00:00:00 2001
From: zhaowenyu <35589726@qq.com>
Date: Sat, 15 Nov 2025 15:35:22 +0800
Subject: [PATCH] 2025-11-15 zwy 增加循环任务枚举
---
ard-sample/src/main/java/com/ard/sample/component/websocket/handler/DockWebSocketHandler.java | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/ard-sample/src/main/java/com/ard/sample/component/websocket/handler/DockWebSocketHandler.java b/ard-sample/src/main/java/com/ard/sample/component/websocket/handler/DockWebSocketHandler.java
index a6f4066..e682685 100644
--- a/ard-sample/src/main/java/com/ard/sample/component/websocket/handler/DockWebSocketHandler.java
+++ b/ard-sample/src/main/java/com/ard/sample/component/websocket/handler/DockWebSocketHandler.java
@@ -100,11 +100,12 @@
_liveStreamService.StartLiveStreaming(sn);
}
} else {
- // 停止直播
- if(MessageType.LIVESTREAM.getType().equals(type)){
- System.out.println("停止直播");
- _liveStreamService.StopLiveStreaming(sn);
- }
+ // 停止直播--前端不主动关注直播,则在断开连接时停止
+// if(MessageType.LIVESTREAM.getType().equals(type)){
+// System.out.println("停止直播");
+//
+// _liveStreamService.StopLiveStreaming(sn);
+// }
// 取消订阅操作
if (subscriptions.containsKey(subscriptionKey)) {
subscriptions.get(subscriptionKey).remove(userId);
@@ -138,12 +139,13 @@
*/
private void removeUserAllSubscriptions(String userId) {
for (Map.Entry<String, Set<String>> entry : subscriptions.entrySet()) {
- if (entry.getKey().contains(MessageType.LIVESTREAM.getType())) {
- String sn = entry.getKey().split(":")[0];
- _liveStreamService.StopLiveStreaming(sn);
- }
+ // 停止直播逻辑
entry.getValue().remove(userId);
if (entry.getValue().isEmpty()) {
+ if (entry.getKey().contains(MessageType.LIVESTREAM.getType())) {
+ String sn = entry.getKey().split(":")[0];
+ _liveStreamService.StopLiveStreaming(sn);
+ }
subscriptions.remove(entry.getKey());
}
}
--
Gitblit v1.9.3