diff --git a/public/home/home.js b/public/home/home.js index bef54bbd4..5811b91c1 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -33,8 +33,14 @@ var swiperRepo = new Swiper(".homepro-list", { }); var output = document.getElementById("newmessage"); -var socket = new WebSocket("ws://" + document.location.host + "/action/notification"); -var messageQueue = []; +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 () { messageQueue = []; console.log("message has connected.");