This commit is contained in:
2025-10-15 23:57:26 +05:30
parent adeccc24fb
commit b66ab53df4
5 changed files with 14 additions and 20 deletions

View File

@@ -211,7 +211,9 @@
wsStatus = 'connecting';
try {
ws = new WebSocket('ws://localhost:8080/api/ws');
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsHost = window.location.host; // Prend automatiquement l'IP:port depuis l'URL
ws = new WebSocket(`${wsProtocol}//${wsHost}/api/ws`);
ws.onopen = () => {
console.log('WebSocket connected');