12345市长热线标准版-前端

main.js 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. if (typeof console == "undefined") {
  2. this.console = { log: function (msg) { } };
  3. }
  4. // 如果浏览器不支持websocket,会使用这个flash自动模拟websocket协议,此过程对开发者透明
  5. WEB_SOCKET_SWF_LOCATION = "./js/websocket/WebSocketMain.swf";
  6. // 开启flash的websocket debug
  7. WEB_SOCKET_DEBUG = true;
  8. var ws, n = 0,
  9. timer;
  10. var lockReconnect = false; //避免重复连接
  11. var obj = {};
  12. var Statess;
  13. var cls = 0;
  14. var lasttime = new Date().getTime();
  15. //创建scoket连接
  16. function createWebSocket() {
  17. try {
  18. $("#top-search li i").removeClass("active");
  19. Connect();
  20. } catch (e) {
  21. reconnect();
  22. }
  23. }
  24. //连接
  25. function Connect() {
  26. ws = new WebSocket("ws://" + huayi.config.socket_ip + ":" + huayi.config.socket_port);
  27. ws.onopen = function () {
  28. console.log(new Date() + " " + "建立连接");
  29. //心跳检测重置
  30. heartCheck.reset().start();
  31. cls = 0;
  32. $(".Login").addClass("active");
  33. lasttime = new Date().getTime();
  34. if ($.cookie("socket_state") != null) {
  35. SetLogin($.cookie("socket_state"));
  36. }
  37. //$(".hwzt").text('连接成功!');
  38. };
  39. //接收到消息的回调方法
  40. ws.onmessage = function (evt) {
  41. //如果获取到消息,心跳检测重置
  42. //拿到任何消息都说明当前连接是正常的
  43. heartCheck.reset().start();
  44. var myDate = new Date();
  45. console.log(myDate + " receive " + evt.data);
  46. var data = JSON.parse(evt.data)[0];
  47. if (data) {
  48. var rlt = data.Result;
  49. if (rlt == true) {
  50. var type = data.Type;
  51. switch (type.toLowerCase()) {
  52. //case "heart": HeartBack(); break;//心跳
  53. case "login":
  54. LoginBack();
  55. break; //签入
  56. case "logout":
  57. LogoutBack();
  58. break; //签出
  59. case "dropcall":
  60. DropCallBack();
  61. break; //挂断
  62. case "makecall":
  63. MakeCallBack();
  64. break; //外呼
  65. case "setstate":
  66. SetState(data);
  67. break; //置忙置闲
  68. //case "saybusy": SayBusyBack(data); break;
  69. //case "sayfree": SayFreeBack(data); break;
  70. case "meeting":
  71. MeetingBack();
  72. break; //多方通话
  73. case "transfer":
  74. TransferBack();
  75. break; //转移
  76. case "hold":
  77. HoldBack();
  78. break; //保持
  79. case "retrieve":
  80. RetrieveBack();
  81. break; //接回
  82. case "incoming":
  83. IncomingBack(data);
  84. break; //来电
  85. case "subscribe":
  86. SubScribeBack();
  87. break; //监测
  88. case "subscribecancel":
  89. SubScribeCancelBack();
  90. break; //停止监测
  91. case "agentstate":
  92. AgentStateBack(data);
  93. break; //坐席状态
  94. case "linestate":
  95. LineStateBack(data);
  96. break; //线路状态
  97. case "motorsetstate":
  98. SayFreeBack();
  99. break; //班长置闲
  100. case "linestateagent":
  101. LineStateAgentBack(data);
  102. break; //线路状态通知
  103. //case "callid":
  104. // CallIDBack(data);
  105. // break; //获取callid
  106. //case "recordpath":
  107. // RecordPathBack(data);
  108. // break; //录音返回
  109. case "getagentlist":
  110. GetAgentListBack(data);
  111. break;//在线坐席信息
  112. case "confirmtransfer":
  113. ConfirmTransfer(data);
  114. break;//确认转移 取消转移
  115. case "consult":
  116. ConsultationCall();
  117. break;//协商呼叫
  118. }
  119. } else {
  120. if (rlt == false) {
  121. //layer.confirm('操作失败!', {
  122. // btn: ['确定']
  123. //});
  124. $(".hwzt").text('操作失败!');
  125. } else {
  126. $(".hwzt").text(rlt);
  127. //layer.confirm(rlt, {
  128. // btn: ['确定']
  129. //});
  130. }
  131. }
  132. }
  133. };
  134. //连接关闭的回调方法
  135. ws.onclose = function (evt) {
  136. if (cls == 0) {
  137. cls = 1;
  138. //console.log("连接关闭!");
  139. //layer.confirm('连接关闭!', {
  140. // btn: ['确定']
  141. //});
  142. $(".hwzt").text('连接关闭!');
  143. $("#top-search li i").removeClass("active");
  144. reconnect();
  145. }
  146. };
  147. //连接发生错误的回调方法
  148. ws.onerror = function (evt) {
  149. //产生异常
  150. $(".hwzt").text('连接出现异常!');
  151. console.log(ws);
  152. if (ws == null || ws.readyState != ws.OPEN) {
  153. console.log(new Date() + "开始重连");
  154. reconnect();
  155. }
  156. };
  157. }
  158. //重连
  159. function reconnect() {
  160. if (lockReconnect) return;
  161. lockReconnect = true;
  162. //没连接上会一直重连,设置延迟避免请求过多
  163. setTimeout(function () {
  164. console.log(new Date() + " " + "重连中……");
  165. createWebSocket("ws://" + huayi.config.socket_ip + ":" + huayi.config.socket_port);
  166. lockReconnect = false;
  167. }, 2000);
  168. }
  169. //发送
  170. function Send() {
  171. if (ws.readyState != ws.OPEN) {
  172. reconnect();
  173. }
  174. if (ws.readyState == ws.OPEN) {
  175. console.log(new Date() + " send " + JSON.stringify(obj));
  176. ws.send(JSON.stringify(obj));
  177. }
  178. }
  179. //心跳检测
  180. var heartCheck = {
  181. timeout: 25000, //25秒
  182. timeoutObj: null,
  183. serverTimeoutObj: null,
  184. reset: function () {
  185. clearTimeout(this.timeoutObj);
  186. clearTimeout(this.serverTimeoutObj);
  187. return this;
  188. },
  189. start: function () {
  190. var self = this;
  191. this.timeoutObj = setTimeout(function () {
  192. //这里发送一个心跳,后端收到后,返回一个心跳消息,
  193. //onmessage拿到返回的心跳就说明连接正常
  194. obj.Type = "Heart";
  195. Send();
  196. self.serverTimeoutObj = setTimeout(function () { //如果超过一定时间还没重置,说明后端主动断开了
  197. ws.close(); //如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
  198. }, self.timeout)
  199. }, this.timeout)
  200. }
  201. }
  202. //签入
  203. function LoginBack() {
  204. $("#top-search li i").removeClass("active");
  205. $(".Logout").addClass("active");
  206. $(".SayBusy").addClass("active");
  207. $(".MakeCall").addClass("active");
  208. $(".zxzt").removeClass("br").addClass("bl");
  209. $(".fwzt").removeClass("br").addClass("bl");
  210. $(".hwzt").text('');
  211. $('.Consult').addClass("active");
  212. if ($.cookie("socket_state") == null) {
  213. SetStateCookie(0);
  214. }
  215. }
  216. //签出
  217. function LogoutBack() {
  218. $("#top-search li i").removeClass("active");
  219. $(".Login").addClass("active");
  220. $(".zxzt").removeClass("bl").addClass("br");
  221. $(".fwzt").removeClass("bl").addClass("br");
  222. $(".hwzt").text('');
  223. SetStateCookie(2);
  224. }
  225. //来电
  226. function IncomingBack(data) {
  227. $(".ldhm").val(data.Number);
  228. $(".hidTel").val(data.Number);
  229. $(".tel").text(data.Number);
  230. $(".ldtime").text(getNowFormatDate());
  231. $(".thsc").text("00:00");
  232. $(".hidCallID").val(data.CallID);
  233. //获取电话所属地
  234. $.getJSON(huayi.config.callcenter_url + 'CallInScreen/GetPhoneLocation', {
  235. "tel": $(".hidTel").val(),
  236. "token": $.cookie("token")
  237. }, function (result) {
  238. if (result.state.toLowerCase() == "success") {
  239. $(".ldlocation").text(result.data[0].F_Name);
  240. $(".khgsd").text(result.data[0].F_Name);
  241. }
  242. })
  243. //获取客户信息
  244. $(".ttsdh").text($(".hidTel").val());
  245. $(".tsdh").val($(".hidTel").val());
  246. $.getJSON(huayi.config.callcenter_url + 'CallInScreen/GetCustomerByTel', {
  247. "tel": $(".hidTel").val(),
  248. "token": $.cookie("token")
  249. }, function (result) {
  250. if (result.state.toLowerCase() == "success") {
  251. if (result.data.length > 0) {
  252. $(".khmc").val(result.data[0].F_CustomerName);
  253. $(".tkhmc").text(result.data[0].F_CustomerName);
  254. $("#khid").val(result.data[0].F_CustomerId);
  255. $(".lxdh").val(result.data[0].F_Telephone);
  256. //$(".tsdh").val(result.data[0].F_Mobile);
  257. //$(".ttsdh").text(result.data[0].F_Mobile);
  258. $(".lxr").val(result.data[0].F_CustomerEName);
  259. $(".postcode").val(result.data[0].F_PostCode);
  260. $(".email").val(result.data[0].F_Email);
  261. }
  262. else {
  263. $(".khmc").val("");
  264. $(".tkhmc").text("");
  265. $("#khid").val("");
  266. $(".lxr").val("");
  267. $(".postcode").val("");
  268. $(".email").val("");
  269. }
  270. }
  271. })
  272. $('.maxOpen').trigger("click");
  273. $('.head-pic .lahei .la-before').show();
  274. //触发来电类型第一个 点击;
  275. $("#dicValueList li:first-child").find("label").trigger('click');
  276. $('.head-pic .lahei .la-after').hide();
  277. $(".Bacha").hide();
  278. }
  279. //挂断
  280. function DropCallBack() {
  281. $("#top-search li i").removeClass("active");
  282. $(".Logout").addClass("active");
  283. $(".SayBusy").addClass("active");
  284. $(".MakeCall").addClass("active");
  285. $(".td-call").hide();
  286. //$('.ldtp-con').css("display", 'none');
  287. }
  288. function LineStateAgentBack(data) {
  289. //0分机不可用,1空闲,2摘机等待拨号,3正在拨号,4呼出振铃,5来电振铃,6通话中,7播放忙音中,8移除IP分机,9通话保持中
  290. if (data.State == '0') {
  291. $(".hwzt").text('分机不可用'); //左下角状态显示
  292. }
  293. if (data.State == '1') {
  294. $(".hwzt").text('空闲'); //左下角状态显示
  295. $(".fwzt").removeClass("br").addClass("bl");
  296. clearInterval(timer);
  297. if ($(".hidTel").val() && $(".hidCallID").val()) {
  298. $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateGJ', {
  299. callid: $(".hidCallID").val(),
  300. "token": $.cookie("token")
  301. }, function (result) {
  302. result = JSON.parse(result);
  303. if (result.state.toLowerCase() == "success") { }
  304. })
  305. }
  306. $("#top-search li i").removeClass("active");
  307. $(".Logout").addClass("active");
  308. $(".SayBusy").addClass("active");
  309. $(".MakeCall").addClass("active");
  310. $(".td-call").hide();
  311. $(".Bacha").show();
  312. //$(".hidTel").val("");
  313. //$(".hidCallID").val("");
  314. }
  315. if (data.State == '2') {
  316. $(".hwzt").text('摘机等待拨号'); //左下角状态显示
  317. }
  318. if (data.State == '3') {
  319. $(".hwzt").text('正在拨号'); //左下角状态显示
  320. }
  321. if (data.State == '4') {
  322. $(".hwzt").text('呼出振铃'); //左下角状态显示
  323. }
  324. if (data.State == '5') {
  325. $(".hwzt").text('来电振铃'); //左下角状态显示
  326. $(".fwzt").removeClass("bl").addClass("br");
  327. if ($(".hidTel").val() && $(".hidCallID").val()) {
  328. $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateZL', {
  329. callid: $(".hidCallID").val(),
  330. "token": $.cookie("token")
  331. }, function (result) {
  332. result = JSON.parse(result);
  333. if (result.state.toLowerCase() == "success") { }
  334. })
  335. }
  336. }
  337. if (data.State == '6') {
  338. $(".hwzt").text('通话中'); //左下角状态显示
  339. $(".fwzt").removeClass("bl").addClass("br");
  340. if ($(".hidTel").val() && $(".hidCallID").val()) {
  341. $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateZJ', {
  342. callid: $(".hidCallID").val(),
  343. "token": $.cookie("token")
  344. }, function (result) {
  345. result = JSON.parse(result);
  346. if (result.state.toLowerCase() == "success") { }
  347. })
  348. }
  349. $(".td-call").show();
  350. n = 0;
  351. $("#top-search li i").removeClass("active");
  352. $(".DropCall").addClass("active");
  353. $(".Hold").addClass("active");
  354. $(".Transfer").addClass("active");
  355. $(".Meeting").addClass("active");
  356. $('.TurnIvr').addClass("active");
  357. $('.Consult').addClass("active");
  358. clearInterval(timer);
  359. timer = setInterval(function () {
  360. n++;
  361. var m = parseInt(n / 60 % 60);
  362. var s = parseInt(n % 60);
  363. $(".thsc").text(toDub(m) + ":" + toDub(s));
  364. }, 1000);
  365. }
  366. if (data.State == '7') {
  367. $(".hwzt").text('播放忙音中'); //左下角状态显示
  368. }
  369. if (data.State == '8') {
  370. $(".hwzt").text('移除IP分机'); //左下角状态显示
  371. }
  372. if (data.State == '9') {
  373. $(".hwzt").text('通话保持中'); //左下角状态显示
  374. }
  375. }
  376. function toDub(i) {
  377. return i < 10 ? "0" + i : "" + i;
  378. }
  379. //外呼
  380. function MakeCallBack() {
  381. $("#top-search li i").removeClass("active");
  382. $(".DropCall").addClass("active");
  383. $(".Meeting").addClass("active");
  384. }
  385. //默认记忆上次是否签入,是否置忙置闲 0表示已签入 空闲,1表示签入置忙,2表示签出
  386. function SetStateCookie(state) {
  387. $.cookie("socket_state", state);
  388. }
  389. //置忙置闲
  390. function SetState(obj) {
  391. if (obj.State == '5') {
  392. $(".SayBusy").removeClass("active");
  393. $(".SayFree").addClass("active");
  394. $(".zxzt").removeClass("bl").addClass("br");
  395. $(".hwzt").text('置忙');
  396. SetStateCookie(1);
  397. }
  398. if (obj.State == '2') {
  399. $(".SayBusy").addClass("active");
  400. $(".SayFree").removeClass("active");
  401. $(".zxzt").removeClass("br").addClass("bl");
  402. $(".hwzt").text('空闲');
  403. SetStateCookie(0);
  404. }
  405. }
  406. function SetLogin(state) {
  407. if (state == 2) { return; }
  408. if (obj.AgentID) {
  409. obj.Type = "Login";
  410. if( $("#RoleCode").val()=='DBHWY'){
  411. obj.AgentGroup = "1";
  412. }else{
  413. obj.AgentGroup = "364";
  414. }
  415. obj.AgentType = "0";
  416. Send();
  417. }
  418. if (state == 1) {
  419. setTimeout('SayBusy()', 500);
  420. }
  421. }
  422. function SayBusy() {
  423. if (obj.AgentID) {
  424. obj.Type = "SayBusy";
  425. Send();
  426. }
  427. }
  428. //置忙
  429. function SayBusyBack() {
  430. $(".SayBusy").removeClass("active");
  431. $(".SayFree").addClass("active");
  432. }
  433. //置闲
  434. function SayFreeBack() {
  435. $(".SayBusy").addClass("active");
  436. $(".SayFree").removeClass("active");
  437. }
  438. //多方通话
  439. function MeetingBack() {
  440. }
  441. //转移
  442. function TransferBack() {
  443. $("#top-search li i").removeClass("active");
  444. $(".Logout").addClass("active");
  445. $(".SayBusy").addClass("active");
  446. $(".MakeCall").addClass("active");
  447. }
  448. //保持
  449. function HoldBack() {
  450. $(".Hold").removeClass("active");
  451. $(".Retrieve").addClass("active");
  452. }
  453. //接回
  454. function RetrieveBack() {
  455. $(".Hold").addClass("active");
  456. $(".Retrieve").removeClass("active");
  457. }
  458. //协商呼叫
  459. function ConsultationCall() {
  460. $('.Consult').removeClass("active");
  461. $('.ConfirmTransfer').addClass("active");//确认转移
  462. $('.CancelTransfer').addClass("active");//取消转移
  463. }
  464. //确认转移&取消转移
  465. function ConfirmTransfer(data) {
  466. if(data.State==3){//取消转移
  467. $('.Consult').addClass("active");
  468. $(".CancelTransfer").removeClass("active");
  469. $(".ConfirmTransfer").removeClass("active");
  470. }else{
  471. //确认转移
  472. $('.Consult').removeClass("active");
  473. $(".CancelTransfer").removeClass("active");
  474. $(".ConfirmTransfer").removeClass("active");
  475. }
  476. }
  477. //监测
  478. function SubScribeBack() {
  479. var obj = $("iframe:visible")
  480. if (obj.attr("data-id") == "./TelCall/SeatMonitor.html") {
  481. window.frames[obj.attr("name")].Start();
  482. }
  483. if (obj.attr("data-id") == "./TelCall/zxKong.html") {
  484. window.frames[obj.attr("name")].Start();
  485. }
  486. }
  487. //取消监测
  488. function SubScribeCancelBack() {
  489. var obj = $("iframe:visible")
  490. if (obj.attr("data-id") == "./TelCall/SeatMonitor.html") {
  491. window.frames[obj.attr("name")].Stop();
  492. }
  493. if (obj.attr("data-id") == "./TelCall/zxKong.html") {
  494. window.frames[obj.attr("name")].Stop();
  495. }
  496. }
  497. //班长监测返回状态
  498. //坐席状态
  499. function AgentStateBack(data) {
  500. var obj = $("iframe:visible")
  501. if (obj.attr("data-id") == "./TelCall/SeatMonitor.html") {
  502. window.frames[obj.attr("name")].UpdateAgentState(data.AgentID, data.State);
  503. }
  504. if (obj.attr("data-id") == "./TelCall/zxKong.html") {
  505. window.frames[obj.attr("name")].UpdateAgentState(data.AgentID, data.State);
  506. }
  507. }
  508. //线路状态
  509. function LineStateBack(data) {
  510. var obj = $("iframe:visible")
  511. if (obj.attr("data-id") == "./TelCall/SeatMonitor.html") {
  512. window.frames[obj.attr("name")].UpdateLineState(data.AgentID, data.State);
  513. }
  514. if (obj.attr("data-id") == "./TelCall/zxKong.html") {
  515. window.frames[obj.attr("name")].UpdateLineState(data.AgentID, data.State);
  516. }
  517. }
  518. //录音返回
  519. function RecordPathBack(data) {
  520. //if ($(".hidTel").val() && $(".hidCallID").val()) {
  521. // $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateLY', { callid: $(".hidCallID").val(),path:data.RecPath, "token": $.cookie("token") }, function (result) {
  522. // result = JSON.parse(result);
  523. // if (result.state.toLowerCase() == "success") {
  524. // }
  525. // })
  526. //}
  527. if ($(".hidTel").val()) {
  528. $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateLY', {
  529. callid: data.CallID,
  530. path: data.RecPath,
  531. "token": $.cookie("token")
  532. }, function (result) {
  533. result = JSON.parse(result);
  534. if (result.state.toLowerCase() == "success") { }
  535. })
  536. }
  537. }
  538. //在线坐席信息
  539. function GetAgentListBack(data) {
  540. console.log(data)
  541. $.ajax({
  542. type: "get",
  543. url: huayi.config.callcenter_url + "SeatMonitoring/GetAgentList",
  544. async: true,
  545. dataType: 'json',
  546. data: {
  547. "token": $.cookie("token")
  548. },
  549. success: function (result) {
  550. var user = result.data;
  551. $(user).each(function (j, m) {
  552. $(data.AgentList).each(function (k, g) {
  553. if (g.AgentID == m.UserCode) {
  554. g.userName = m.UserName;
  555. }
  556. })
  557. })
  558. $(data.AgentList).each(function (k, m) {
  559. var strr = '';
  560. switch (m.State) {
  561. case "0":
  562. strr = "离线";
  563. break; //离线
  564. case "1":
  565. break; //登录中
  566. case "2":
  567. strr = "空闲";
  568. break; //空闲
  569. case "3":
  570. strr = "通话中";
  571. break; //通话中
  572. case "4":
  573. strr = "话后处理中";
  574. break; //话后处理中
  575. case "5":
  576. strr = "忙碌";
  577. break; //小休
  578. case "6":
  579. strr = "振铃";
  580. break; //被请求
  581. case "7":
  582. strr = "注销";
  583. break; //注销
  584. }
  585. var html = '<tr fjh="' + m.AgentExten + '">' +
  586. '<td>' + (m.userName ? '' : m.userName) + '</td>' //姓名
  587. +
  588. '<td>' + m.AgentID + '</td>' //工号
  589. +
  590. '<td>' + m.AgentExten + '</td>'//分机号
  591. +
  592. '<td class=" ' + m.UserCode + 'state">' + strr + '</td>' //状态
  593. +
  594. '</tr>';
  595. $(html).appendTo("#zxTable tbody");
  596. })
  597. }
  598. });
  599. }
  600. //获取当前的日期时间 格式“yyyy-MM-dd HH:mm:ss”
  601. function getNowFormatDate() {
  602. var date = new Date();
  603. var seperator1 = "-";
  604. var seperator2 = ":";
  605. var month = date.getMonth() + 1;
  606. var strDate = date.getDate();
  607. if (month >= 1 && month <= 9) {
  608. month = "0" + month;
  609. }
  610. if (strDate >= 0 && strDate <= 9) {
  611. strDate = "0" + strDate;
  612. }
  613. var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate +
  614. " " + date.getHours() + seperator2 + date.getMinutes() +
  615. seperator2 + date.getSeconds();
  616. return currentdate;
  617. }
  618. var iswebcloase = 1;
  619. window.onunload = function () {
  620. if (iswebcloase) {
  621. iswebcloase = 0;
  622. if (ws.readyState == ws.OPEN) {
  623. obj.Type = 'Logout';
  624. Send();
  625. ws.onclose();
  626. }
  627. }
  628. }
  629. window.onbeforeunload = function () {
  630. if (iswebcloase) {
  631. iswebcloase = 0;
  632. if (ws.readyState == ws.OPEN) {
  633. obj.Type = 'Logout';
  634. Send();
  635. ws.onclose();
  636. }
  637. }
  638. }