Commit 788559e0 authored by Allencl's avatar Allencl

1

parent 713bb349
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
.catch(error => console.error('Error:', error)); .catch(error => console.error('Error:', error));
}, },
initWebSocket(){ initWebSocket(){
// console.log('1111+++='+codeDianshi) // // console.log('1111+++='+codeDianshi)
var iframe1 = document.getElementById('myiframe1').contentWindow; var iframe1 = document.getElementById('myiframe1').contentWindow;
var iframe2 = document.getElementById('myiframe2').contentWindow; var iframe2 = document.getElementById('myiframe2').contentWindow;
var iframe3 = document.getElementById('myiframe3').contentWindow; var iframe3 = document.getElementById('myiframe3').contentWindow;
...@@ -217,7 +217,7 @@ ...@@ -217,7 +217,7 @@
//监听是否连接成功 //监听是否连接成功
ws.onopen = function () { ws.onopen = function () {
wsState = ws.readyState wsState = ws.readyState
console.log('ws连接状态:' + ws.readyState); // console.log('ws连接状态:' + ws.readyState);
var _json1={ var _json1={
type:'conStatusChange', type:'conStatusChange',
newStatus:false newStatus:false
...@@ -228,13 +228,13 @@ ...@@ -228,13 +228,13 @@
} }
// 接听服务器发回的信息并处理展示 // 接听服务器发回的信息并处理展示
ws.onmessage = function (option = {}) { ws.onmessage = function (option = {}) {
console.log('ws收到消息'); // console.log('ws收到消息');
// console.log('ws连接状态:' + ws.readyState); // // console.log('ws连接状态:' + ws.readyState);
wsState = ws.readyState wsState = ws.readyState
const {data = "{}"} = option const {data = "{}"} = option
const _data = JSON.parse(data) const _data = JSON.parse(data)
// console.log(_data); // // console.log(_data);
iframe1.postMessage(JSON.stringify(_data), '*'); iframe1.postMessage(JSON.stringify(_data), '*');
iframe2.postMessage(JSON.stringify(_data), '*'); iframe2.postMessage(JSON.stringify(_data), '*');
iframe3.postMessage(JSON.stringify(_data), '*'); iframe3.postMessage(JSON.stringify(_data), '*');
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
ws.onclose = function () { ws.onclose = function () {
wsState = ws.readyState wsState = ws.readyState
// 监听整个过程中websocket的状态 // 监听整个过程中websocket的状态
console.log('ws连接关闭状态:' + ws.readyState); // console.log('ws连接关闭状态:' + ws.readyState);
var _json1={ var _json1={
type:'conStatusChange', type:'conStatusChange',
newStatus:true newStatus:true
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
} }
// 监听并处理error事件 // 监听并处理error事件
ws.onerror = function (error) { ws.onerror = function (error) {
console.log('ws连接报错状态:' +error); // console.log('ws连接报错状态:' +error);
wsState = ws.readyState wsState = ws.readyState
var _json1={ var _json1={
type:'conStatusChange', type:'conStatusChange',
...@@ -263,8 +263,8 @@ ...@@ -263,8 +263,8 @@
iframe1.postMessage(JSON.stringify(_json1), '*'); iframe1.postMessage(JSON.stringify(_json1), '*');
iframe2.postMessage(JSON.stringify(_json1), '*'); iframe2.postMessage(JSON.stringify(_json1), '*');
iframe3.postMessage(JSON.stringify(_json1), '*'); iframe3.postMessage(JSON.stringify(_json1), '*');
// console.log('错误error' + error); // // console.log('错误error' + error);
// console.log('错误:ws连接状态:' + ws.readyState); // // console.log('错误:ws连接状态:' + ws.readyState);
} }
} }
function initBroadcastWebsocketFunc() { function initBroadcastWebsocketFunc() {
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
//监听是否连接成功 //监听是否连接成功
broadcastWs.onopen = function () { broadcastWs.onopen = function () {
bwsState = broadcastWs.readyState; bwsState = broadcastWs.readyState;
// console.log('bws连接状态:' + broadcastWs.readyState); // // console.log('bws连接状态:' + broadcastWs.readyState);
var _json1={ var _json1={
type:'conStatusChange', type:'conStatusChange',
newStatus:false newStatus:false
...@@ -285,14 +285,14 @@ ...@@ -285,14 +285,14 @@
} }
// 接听服务器发回的信息并处理展示 // 接听服务器发回的信息并处理展示
broadcastWs.onmessage = function (option = {}) { broadcastWs.onmessage = function (option = {}) {
// console.log('bws收到信息'); // // console.log('bws收到信息');
// console.log('bws连接状态:' + broadcastWs.readyState); // // console.log('bws连接状态:' + broadcastWs.readyState);
bwsState = broadcastWs.readyState bwsState = broadcastWs.readyState
const {data = "{}"} = option const {data = "{}"} = option
const _data = JSON.parse(data) const _data = JSON.parse(data)
// console.log(_data); // // console.log(_data);
iframe1.postMessage(JSON.stringify(_data), '*'); iframe1.postMessage(JSON.stringify(_data), '*');
iframe2.postMessage(JSON.stringify(_data), '*'); iframe2.postMessage(JSON.stringify(_data), '*');
iframe3.postMessage(JSON.stringify(_data), '*'); iframe3.postMessage(JSON.stringify(_data), '*');
...@@ -301,7 +301,7 @@ ...@@ -301,7 +301,7 @@
broadcastWs.onclose = function () { broadcastWs.onclose = function () {
bwsState = broadcastWs.readyState bwsState = broadcastWs.readyState
// 监听整个过程中websocket的状态 // 监听整个过程中websocket的状态
// console.log('bws连接关闭状态:' + broadcastWs.readyState); // // console.log('bws连接关闭状态:' + broadcastWs.readyState);
var _json1={ var _json1={
type:'conStatusChange', type:'conStatusChange',
newStatus:true newStatus:true
...@@ -320,8 +320,8 @@ ...@@ -320,8 +320,8 @@
iframe1.postMessage(JSON.stringify(_json1), '*'); iframe1.postMessage(JSON.stringify(_json1), '*');
iframe2.postMessage(JSON.stringify(_json1), '*'); iframe2.postMessage(JSON.stringify(_json1), '*');
iframe3.postMessage(JSON.stringify(_json1), '*'); iframe3.postMessage(JSON.stringify(_json1), '*');
// console.log('错误error' + error); // // console.log('错误error' + error);
// console.log('错误:bws连接状态:' + broadcastWs.readyState); // // console.log('错误:bws连接状态:' + broadcastWs.readyState);
} }
} }
...@@ -338,7 +338,7 @@ ...@@ -338,7 +338,7 @@
initBroadcastWebsocketFunc() // 初始化 initBroadcastWebsocketFunc() // 初始化
// $("#selectCodeContainer").css("z-index",-999) // $("#selectCodeContainer").css("z-index",-999)
window.IntervalItemCenter13 = setInterval(() => { window.IntervalItemCenter13 = setInterval(() => {
// console.log('111==='+wsState+'222==='+bwsState); // // console.log('111==='+wsState+'222==='+bwsState);
if (wsState != 1 || bwsState != 1 ) { if (wsState != 1 || bwsState != 1 ) {
initUlocWebsocketFunc() // 初始化 initUlocWebsocketFunc() // 初始化
initBroadcastWebsocketFunc() // 初始化 initBroadcastWebsocketFunc() // 初始化
......
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 to comment