提交: 监控大屏 添加ws guid 唯一值

This commit is contained in:
23688nl 2022-08-11 17:08:37 +08:00
parent 03ee1d17f7
commit 9f541a4156
1 changed files with 10 additions and 1 deletions

View File

@ -240,6 +240,15 @@ export default {
this.projectSpaceCensusList = res.data || [];
});
},
getGuid() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
c
) {
var r = (Math.random() * 16) | 0,
v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
},
// ws
connection() {
if (this.stompClient) {
@ -249,7 +258,7 @@ export default {
return;
}
this.stompClient = new WebSocket(
`${bigWebSocketUrl}/${this.projectId || -1}`
`${bigWebSocketUrl}/${this.getGuid()}/${this.projectId || -1}`
);
this.stompClient.onmessage = this.socket_onmsg;
this.stompClient.onclose = this.socket_onclose;