Implemented secure WebSocket connection based on the current protocol.

This commit is contained in:
Benjamin Arntzen (aider)
2024-06-27 09:41:05 +01:00
parent 78a5a3e60b
commit afa1771c51
+2 -1
View File
@@ -1,4 +1,5 @@
const socket = new WebSocket(`ws://${window.location.host}`);
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const socket = new WebSocket(`${protocol}//${window.location.host}`);
socket.addEventListener('open', () => {
console.log('WebSocket connection established');