|
|
|
@ -202,8 +202,12 @@
@@ -202,8 +202,12 @@
|
|
|
|
|
initWebSocket: function () { |
|
|
|
|
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https |
|
|
|
|
var userId = store.getters.userInfo.id; |
|
|
|
|
var url = window._CONFIG['domianURL'].replace("https://","wss://").replace("http://","ws://")+"/websocket/"+userId; |
|
|
|
|
//console.log(url); |
|
|
|
|
let domainUrl = window._CONFIG['domianURL']; |
|
|
|
|
if (!domainUrl.endsWith('/')) { |
|
|
|
|
domainUrl = domainUrl + '/'; |
|
|
|
|
} |
|
|
|
|
var url = domainUrl.replace("https://","wss://").replace("http://","ws://") + "websocket/" + userId; |
|
|
|
|
console.log(url); |
|
|
|
|
//update-begin-author:taoyan date:2022-4-22 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278 |
|
|
|
|
let token = Vue.ls.get(ACCESS_TOKEN) |
|
|
|
|
this.websock = new WebSocket(url, [token]); |
|
|
|
|