From c9111d1bfcb63312ab650c9241211502d65fe231 Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Sun, 4 May 2025 13:15:49 +0800 Subject: [PATCH] =?UTF-8?q?update:=E4=BC=98=E5=8C=96websocket=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/xiaozhi/modules/sys/utils/WebSocketValidator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/manager-api/src/main/java/xiaozhi/modules/sys/utils/WebSocketValidator.java b/main/manager-api/src/main/java/xiaozhi/modules/sys/utils/WebSocketValidator.java index d9ff280b..39bbe01f 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/sys/utils/WebSocketValidator.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/sys/utils/WebSocketValidator.java @@ -8,6 +8,7 @@ import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.web.socket.WebSocketHttpHeaders; import org.springframework.web.socket.client.WebSocketClient; import org.springframework.web.socket.client.standard.StandardWebSocketClient; @@ -45,8 +46,9 @@ public class WebSocketValidator { try { WebSocketClient client = new StandardWebSocketClient(); CompletableFuture future = new CompletableFuture<>(); + WebSocketHttpHeaders headers = new WebSocketHttpHeaders(); - client.doHandshake(new WebSocketTestHandler(future), null, URI.create(url)); + client.execute(new WebSocketTestHandler(future), headers, URI.create(url)); // 等待最多5秒获取连接结果 return future.get(5, TimeUnit.SECONDS);