From 85253e94a5170bb0cd09fb2ab9e530bac660f48d Mon Sep 17 00:00:00 2001 From: Tian jianyong <11429339@qq.com> Date: Mon, 20 Oct 2025 16:06:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=20websocket=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=8A=A0=E4=B8=8AIP=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=92=8C=E7=AB=AF=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/test_websocket.html | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tools/test_websocket.html b/tools/test_websocket.html index e62bde2d..0aafb60e 100644 --- a/tools/test_websocket.html +++ b/tools/test_websocket.html @@ -140,8 +140,17 @@
+ + : + + + +
+ +
+
@@ -178,6 +187,24 @@ let reconnectAttempts = 0; const maxReconnectAttempts = 5; + // 更新服务器地址 + function updateServerAddress() { + const ip = document.getElementById('collisionServerIP').value || 'localhost'; + const port = document.getElementById('collisionServerPort').value || '8080'; + const path = document.getElementById('collisionServerPath').value || '/collision'; + + // 确保路径以 / 开头 + const formattedPath = path.startsWith('/') ? path : '/' + path; + + const serverUrl = `ws://${ip}:${port}${formattedPath}`; + + // 更新下拉框 + const select = document.getElementById('collisionServerSelect'); + select.innerHTML = ``; + + log('collisionLog', `服务器地址已更新为: ${serverUrl}`, 'info'); + } + // 消息统计 let messageStats = { total: 0, @@ -606,6 +633,8 @@ // 页面加载完成 window.onload = function() { + // 初始化服务器地址 + updateServerAddress(); log('collisionLog', '冲突检测WebSocket测试就绪', 'info'); };