ws or wss

This commit is contained in:
Captain.B 2020-07-07 18:23:37 +08:00
parent 1ab097bc29
commit 712154dd8a
1 changed files with 5 additions and 1 deletions

View File

@ -139,7 +139,11 @@
}
},
initWebSocket() {
const uri = "ws://" + window.location.host + "/performance/report/" + this.reportId;
let protocol = "ws://";
if (window.location.protocol === 'https:') {
protocol = "wss://";
}
const uri = protocol + window.location.host + "/performance/report/" + this.reportId;
this.websocket = new WebSocket(uri);
this.websocket.onmessage = this.onMessage;
this.websocket.onopen = this.onOpen;