| | |
| | | if ( 'WebSocket' in window ) {
|
| | | speechSokt = new WebSocket( Uri ); // 定义socket连接对象
|
| | | speechSokt.onopen = function(e){onOpen(e);}; // 定义响应函数
|
| | | speechSokt.onclose = function(e){onClose(e);};
|
| | | speechSokt.onclose = function(e){
|
| | | console.log("onclose ws!");
|
| | | speechSokt.close();
|
| | | onClose(e);
|
| | | };
|
| | | speechSokt.onmessage = function(e){onMessage(e);};
|
| | | speechSokt.onerror = function(e){onError(e);};
|
| | | return 1;
|
| | |
| | | // 定义停止与发送函数
|
| | | this.wsStop = function () {
|
| | | if(speechSokt != undefined) {
|
| | | console.log("stop ws!");
|
| | | speechSokt.close();
|
| | | }
|
| | | };
|