From b63e73ae4f5df9d4ed9fb0bee12ac2cc09d7f523 Mon Sep 17 00:00:00 2001
From: zhaomingwork <zhaomingwork@qq.com>
Date: 星期五, 19 五月 2023 14:30:13 +0800
Subject: [PATCH] add asr wss address input to html

---
 funasr/runtime/html5/static/wsconnecter.js |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/funasr/runtime/html5/static/wsconnecter.js b/funasr/runtime/html5/static/wsconnecter.js
index 594652d..82d751b 100644
--- a/funasr/runtime/html5/static/wsconnecter.js
+++ b/funasr/runtime/html5/static/wsconnecter.js
@@ -5,7 +5,8 @@
 /* 2021-2023 by zhaoming,mali aihealthx.com */
 
 function WebSocketConnectMethod( config ) { //瀹氫箟socket杩炴帴鏂规硶绫�
-    var Uri = "wss://30.220.136.139:5921/"  //	var Uri = "wss://30.221.177.46:5921/" //璁剧疆wss asr online鎺ュ彛鍦板潃 濡� wss://X.X.X.X:port/wss/
+
+	
 	var speechSokt;
 	var connKeeperID;
 	
@@ -13,16 +14,28 @@
 	var stateHandle = config.stateHandle;
 			  
 	this.wsStart = function () {
-		
+		var Uri = document.getElementById('wssip').value; //"wss://111.205.137.58:5821/wss/" //璁剧疆wss asr online鎺ュ彛鍦板潃 濡� wss://X.X.X.X:port/wss/
+ 
+		if(Uri.match(/wss:\S*/))
+		{
+			console.log("Uri"+Uri);
+		}
+		else
+		{
+			alert("璇锋鏌ss鍦板潃姝g‘鎬�");
+			return 0;
+		}
 		if ( 'WebSocket' in window ) {
 			speechSokt = new WebSocket( Uri ); // 瀹氫箟socket杩炴帴瀵硅薄
 			speechSokt.onopen = function(e){onOpen(e);}; // 瀹氫箟鍝嶅簲鍑芥暟
 			speechSokt.onclose = function(e){onClose(e);};
 			speechSokt.onmessage = function(e){onMessage(e);};
 			speechSokt.onerror = function(e){onError(e);};
+			return 1;
 		}
 		else {
 			alert('褰撳墠娴忚鍣ㄤ笉鏀寔 WebSocket');
+			return 0;
 		}
 	};
 	

--
Gitblit v1.9.1