|
|
|
@ -289,42 +289,42 @@ export default {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch((err) => {});
|
|
|
|
.catch((err) => {});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
initWebSocket() {
|
|
|
|
// initWebSocket() {
|
|
|
|
//初始化weosocket
|
|
|
|
// //初始化weosocket
|
|
|
|
const wsuri = "ws://127.0.0.1:8099/ws/111";
|
|
|
|
// const wsuri = "ws://127.0.0.1:8099/ws/111";
|
|
|
|
this.websock = new WebSocket(wsuri);
|
|
|
|
// this.websock = new WebSocket(wsuri);
|
|
|
|
this.websock.onmessage = this.websocketonmessage;
|
|
|
|
// this.websock.onmessage = this.websocketonmessage;
|
|
|
|
this.websock.onopen = this.websocketonopen;
|
|
|
|
// this.websock.onopen = this.websocketonopen;
|
|
|
|
this.websock.onerror = this.websocketonerror;
|
|
|
|
// this.websock.onerror = this.websocketonerror;
|
|
|
|
this.websock.onclose = this.websocketclose;
|
|
|
|
// this.websock.onclose = this.websocketclose;
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
websocketonopen() {
|
|
|
|
// websocketonopen() {
|
|
|
|
//连接建立之后执行send方法发送数据
|
|
|
|
// //连接建立之后执行send方法发送数据
|
|
|
|
this.websocketsend(JSON.stringify(actions));
|
|
|
|
// this.websocketsend(JSON.stringify(actions));
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
websocketonerror() {
|
|
|
|
// websocketonerror() {
|
|
|
|
//连接建立失败重连
|
|
|
|
// //连接建立失败重连
|
|
|
|
this.initWebSocket();
|
|
|
|
// this.initWebSocket();
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
websocketonmessage(e) {
|
|
|
|
// websocketonmessage(e) {
|
|
|
|
console.log("aaaa");
|
|
|
|
// console.log("aaaa");
|
|
|
|
var el = JSON.parse(e.data)
|
|
|
|
// var el = JSON.parse(e.data)
|
|
|
|
console.log(el.type);
|
|
|
|
// console.log(el.type);
|
|
|
|
|
|
|
|
|
|
|
|
if (el.type == "InventoryPush") {
|
|
|
|
// if (el.type == "InventoryPush") {
|
|
|
|
this.wsData.push(el);
|
|
|
|
// this.wsData.push(el);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
//数据接收
|
|
|
|
// //数据接收
|
|
|
|
const redata = JSON.parse(e.data);
|
|
|
|
// const redata = JSON.parse(e.data);
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
websocketsend(Data) {
|
|
|
|
// websocketsend(Data) {
|
|
|
|
//数据发送
|
|
|
|
// //数据发送
|
|
|
|
this.websock.send(Data);
|
|
|
|
// this.websock.send(Data);
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
websocketclose(e) {
|
|
|
|
// websocketclose(e) {
|
|
|
|
//关闭
|
|
|
|
// //关闭
|
|
|
|
console.log("断开连接", e);
|
|
|
|
// console.log("断开连接", e);
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
components: {
|
|
|
|
Subsection,
|
|
|
|
Subsection,
|
|
|
|
|