#1306 解决https的 websocket请求

Merged
lewis merged 4 commits from zouap_1 into V20220110 2 years ago
  1. +7
    -1
      public/home/home.js

+ 7
- 1
public/home/home.js View File

@@ -33,7 +33,13 @@ var swiperRepo = new Swiper(".homepro-list", {
});

var output = document.getElementById("newmessage");
var socket = new WebSocket("ws://" + document.location.host + "/action/notification");
console.log("document.location.host="+document.location.host);
console.log("document.URL="+document.URL);
var url = "ws://" + document.location.host + "/action/notification";
if(document.location.host == "git.openi.org.cn" || document.URL.startsWith("https")){
url = "wss://" + document.location.host + "/action/notification"
}
var socket = new WebSocket(url);

socket.onopen = function () {
console.log("message has connected.");


Loading…
Cancel
Save