Use secure WebSocket protocol based on location

This commit is contained in:
2025-05-28 17:24:03 +02:00
parent 9a0992f792
commit 0f2675b953

View File

@@ -246,7 +246,8 @@ class SpinnerController {
connectWebSocket() {
if (this.ws) this.ws.close();
this.ws = new WebSocket(`ws://${location.host}`);
const wsProtocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
this.ws = new WebSocket(`${wsProtocol}://${location.host}`);
this.ws.addEventListener('open', () => {
this.connected = true;
console.log("WebSocket connected!");