From c42614978ff12013a1eabebd0289b27169a5784f Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期二, 06 五月 2025 17:25:56 +0800 Subject: [PATCH] 1、实现万功能token(0000-0000-1234-9876-5); 2、web端单独实现命令结果等待器,并相应修改相关部分; 3、web端实现透传命令; 4、修改一些不当注释; 5、优化一些代码。 --- pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/largeScreen/WebSocketServer.java | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/largeScreen/WebSocketServer.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/largeScreen/WebSocketServer.java index fd66ef4..f2c0041 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/largeScreen/WebSocketServer.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/largeScreen/WebSocketServer.java @@ -1,6 +1,7 @@ package com.dy.pipIrrRemote.largeScreen; import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import jakarta.websocket.*; @@ -13,10 +14,13 @@ * @Author: liurunyu * @Date: 2025/2/10 15:25 * @Description 瀹㈡埛绔紙娴忚鍣級姣忓缓绔嬩竴涓獁ebsocket杩炴帴锛屾湇鍔$灏变細鍒涘缓涓�涓猈ebSocketServer瀹炰緥 + * 搴旂敤鍓嶆彁鏄瓨鍦ㄤ竴涓狢onfig绫伙紝濡傛湰妯″潡鐨刉ebSocketConfig锛岃繖鏃禓ServerEndpoint鍙桽pringBoot瀹瑰櫒 + * 绠$悊浜嗭紙鍦ㄥ祵鍏ュ紡web Servlet鐜涓級 */ @Slf4j @ServerEndpoint("/websocket/ls/{id}") @Component +@Scope("prototype") // 闈炲崟渚嬶紝姣忔璇锋眰閮戒細鍒涘缓鏂扮殑瀹炰緥 public class WebSocketServer { // 闈欐�佸彉閲忥紝璁板綍褰撳墠鍦ㄧ嚎杩炴帴鏁� @@ -103,7 +107,7 @@ /** * 鏈嶅姟鍣ㄤ富鍔ㄧ兢鎺ㄩ�佹秷鎭� */ - public static void sendAllMessage(String message) throws IOException { + public static void sendMessage2AllClient(String message) throws IOException { ConcurrentHashMap.KeySetView<String, WebSocketServer> ids = webSocketMap.keySet(); for (String id : ids) { WebSocketServer webSocketServer = webSocketMap.get(id); @@ -114,7 +118,7 @@ /** * 鏈嶅姟鍣ㄦ寚瀹氬鎴风鎺ㄩ�佹秷鎭� */ - public static void sendOneMessage(String message, String id) throws IOException { + public static void sendMessage2OneClient(String message, String id) throws IOException { if (message != null && message.length() != 0 && webSocketMap.containsKey(id)) { webSocketMap.get(id).sendMessage(message); } else { -- Gitblit v1.8.0