From ac484ca3da382a4a7d2d1fdc1c3606cc99885748 Mon Sep 17 00:00:00 2001 From: Bagas Aulia Rezki Date: Mon, 9 Sep 2024 21:50:34 +0700 Subject: [PATCH] Fix WebSocket protocol handling based on page protocol --- public/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/main.js b/public/main.js index 2bc9ef3..aa90084 100644 --- a/public/main.js +++ b/public/main.js @@ -1,6 +1,6 @@ if (!window.mySocket) { const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - window.mySocket = new WebSocket(`${wsProtocol}://${window.location.host}/user`); + window.mySocket = new WebSocket(`${wsProtocol}//${window.location.host}/user`); window.mySocket.onopen = function(event) { console.log('WebSocket is open now.');