From 4b9549dfbf55d8af415efe609623e9d19dd6e6d4 Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: 星期四, 21 一月 2021 19:57:57 +0800 Subject: [PATCH] 添加浏览器ID,确保SSE可同时推送到不同的前端 --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java index a4389cf..0c00b82 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java @@ -13,6 +13,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; +import org.springframework.util.ConcurrentReferenceHashMap; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -20,6 +21,7 @@ import java.text.DecimalFormat; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** * @Description:閽堝 ZLMediaServer鐨刪ook浜嬩欢璁㈤槄 @@ -50,7 +52,7 @@ void response(JSONObject response); } - private Map<HookType, Map<JSONObject, ZLMHttpHookSubscribe.Event>> allSubscribes = new HashMap<>(); + private Map<HookType, Map<JSONObject, ZLMHttpHookSubscribe.Event>> allSubscribes = new ConcurrentHashMap<>(); public void addSubscribe(HookType type, JSONObject hookResponse, ZLMHttpHookSubscribe.Event event) { Map<JSONObject, Event> eventMap = allSubscribes.get(type); -- Gitblit v1.8.0