Commit 8e79daa9 by libai

测试

parent a8229bd5
Showing with 10 additions and 21 deletions
...@@ -506,7 +506,7 @@ ...@@ -506,7 +506,7 @@
function WebSocketStart(guestid,send) { function WebSocketStart(guestid,send) {
clearInterval(timmer)
state("连接中"); state("连接中");
if(ws!=null&&ws.readyState == WebSocket.OPEN){ if(ws!=null&&ws.readyState == WebSocket.OPEN){
system("The socket is opening,please close first!"); system("The socket is opening,please close first!");
...@@ -524,7 +524,7 @@ ...@@ -524,7 +524,7 @@
} }
ws.onopen = function() ws.onopen = function()
{ {
recOk=true;
state("连接成功"); state("连接成功");
system("客服已接入"); system("客服已接入");
if(send){ if(send){
...@@ -549,13 +549,9 @@ ...@@ -549,13 +549,9 @@
$("#guestid").val(''); $("#guestid").val('');
tips("连接已断开","error",3000); tips("连接已断开","error",3000);
if(recOk){ if(recOk){
var recNum=0 var guestid=$("#guestid").val();
timmer=setInterval(function(){ WebSocketStart(guestid,false)
var guestid=$("#guestid").val(); recOk=false;
WebSocketStart(guestid,false)
recNum++
if(recNum>=5)clearInterval(timmer)
}, 3000);
} }
console.error("WebSocket close observed:", event); console.error("WebSocket close observed:", event);
...@@ -563,18 +559,11 @@ ...@@ -563,18 +559,11 @@
ws.onerror = function(event) ws.onerror = function(event)
{ {
// 关闭 websocket // 关闭 websocket
var guestid=$("#guestid").val(); if(recOk){
WebSocketStart(guestid,false) var guestid=$("#guestid").val();
// if(recOk){ WebSocketStart(guestid,false)
// var recNum=0 recOk=false;
// timmer=setInterval(function(){ }
// recNum++
// if(recNum>=5)clearInterval(timmer)
// }, 3000);
// }
state("连接错误"); state("连接错误");
msgbulid(1,"会话意外断开,发送消息即可联系客服","系统",1); msgbulid(1,"会话意外断开,发送消息即可联系客服","系统",1);
console.error("WebSocket error observed:", event); console.error("WebSocket error observed:", event);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment