This commit is contained in:
Lizandro Guarnizo
2026-01-27 15:04:51 -05:00
parent 6e3f375f91
commit 56c6a24fa5
4 changed files with 463 additions and 3 deletions
+5 -3
View File
@@ -1081,9 +1081,11 @@
console.log('Conectando a SSE para eventos en tiempo real...');
try {
// EventSource no soporta withCredentials directamente
// Usar token en URL como alternativa
const sseUrl = 'api/sse_events.php?token=demo_token&t=' + Date.now();
// Detectar URL base automáticamente (funciona en dev y producción)
const baseUrl = window.location.origin; // http://localhost:8000 o https://tu-dominio.com
const sseUrl = `${baseUrl}/api/sse_events.php?token=demo_token&t=${Date.now()}`;
console.log('SSE URL:', sseUrl);
this.eventSource = new EventSource(sseUrl);
// Evento: conexión establecida