Spaces:
Sleeping
Sleeping
Update static/index.html
Browse files- static/index.html +3 -1
static/index.html
CHANGED
@@ -382,7 +382,9 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
382 |
|
383 |
// Function to connect/reconnect WebSocket
|
384 |
function connectWebSocket() {
|
385 |
-
|
|
|
|
|
386 |
|
387 |
ws.onopen = () => {
|
388 |
addMessage('Connected to the server.', 'system');
|
|
|
382 |
|
383 |
// Function to connect/reconnect WebSocket
|
384 |
function connectWebSocket() {
|
385 |
+
|
386 |
+
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
387 |
+
ws = new WebSocket(`${protocol}//${window.location.host}/ws/${endpoint}`);
|
388 |
|
389 |
ws.onopen = () => {
|
390 |
addMessage('Connected to the server.', 'system');
|