| | |
| | | /* 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;
|
| | |
|
| | |
| | | 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("请检查wss地址正确性");
|
| | | 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;
|
| | | }
|
| | | };
|
| | |
|