Spaces:
Running
Running
Nirav Madhani
commited on
Update index.html
Browse filesFix secure connection
- index.html +2 -1
index.html
CHANGED
@@ -327,7 +327,8 @@
|
|
327 |
|
328 |
function connectWebSocket() {
|
329 |
try {
|
330 |
-
|
|
|
331 |
|
332 |
socket.onopen = () => {
|
333 |
logMessage('websocket', 'Connected to server');
|
|
|
327 |
|
328 |
function connectWebSocket() {
|
329 |
try {
|
330 |
+
const wsUrl = `${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}//${window.location.host}/ws`;
|
331 |
+
socket = new WebSocket(wsUrl);
|
332 |
|
333 |
socket.onopen = () => {
|
334 |
logMessage('websocket', 'Connected to server');
|