From 4516e72b5c4f499508b0d1079f58c7dc89ecae2a Mon Sep 17 00:00:00 2001 From: srcrs Date: Fri, 28 Jul 2023 02:38:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=BD=93=E4=BD=BF=E7=94=A8ht?= =?UTF-8?q?tps=E8=BF=9E=E6=8E=A5ws=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 26ba594..88d8d9c 100644 --- a/index.html +++ b/index.html @@ -103,7 +103,8 @@ }; }, async created() { - const socket = new WebSocket("ws://" + window.location.host + "/ws"); + const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://'; + const socket = new WebSocket(protocol + window.location.host + "/ws"); socket.onmessage = event => { const feed = JSON.parse(event.data); this.feeds.push(feed);