From 4f99f59668c9160ca60958b7347944def26f2228 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期日, 27 四月 2025 10:58:53 +0800
Subject: [PATCH] 回退配置

---
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/largeScreen/WebSocketServer.java |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 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 423b4e8..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 {
 
     // 闈欐�佸彉閲忥紝璁板綍褰撳墠鍦ㄧ嚎杩炴帴鏁�
@@ -27,7 +31,8 @@
 
     // 瀹㈡埛绔繛鎺ヤ細璇濓紝閫氳繃瀹冪粰瀹㈡埛绔彂閫佹暟鎹�
     private Session session;
-
+    // 瀹㈡埛绔笂绾挎椂鍒�
+    //private String onLineDt ;
     // 瀹㈡埛绔痠d
     private String id = "";
 
@@ -39,6 +44,7 @@
     @OnOpen
     public void onOpen(Session session, @PathParam("id") String id) {
         this.session = session;
+        //this.onLineDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;
         this.id = id;
         if(this.id == null || this.id.length() == 0){
             this.id = "" + System.nanoTime() ;
@@ -101,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);
@@ -112,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