2
0
imndx 1 жил өмнө
parent
commit
c7f2c8c44a

+ 4 - 0
wstool/css/socket.js

@@ -63,6 +63,10 @@ var Vm = new Vue({
             }, 3000);
         },
         autoWsConnect: function () {
+            if(this.address.startsWith('ws://') && location.href.startsWith('https://')){
+                alert('开启连接失败。仅当当前网页是 http 方式加载时,才能测试 ws 连接,请手动用 http 方式加载本页面')
+                return;
+            }
             try {
                 if (this.connected === false){
                     localStorage.setItem('address', this.address)

+ 1 - 0
wstool/index.html

@@ -63,6 +63,7 @@
                                             </div>
                                             <div class="wf-tip">
                                                 说明:
+                                                <div style="color: red">0. 测试ws(非 wss)连接时,请确保本网页是通过 http 方式加载,如果不是的话,需要手动调整为 http 方式加载</div>
                                                 <div>1. im-server-host 填节点域名</div>
                                                 <div>2. websocket(ws) 端口默认是 8083</div>
                                                 <div>3. secure websocket(wss) 端口默认是 8084</div>