Update WebSocket configuration and clean up docker-compose

This commit is contained in:
Omar Sánchez Pizarro
2026-01-19 21:49:40 +01:00
parent 5cc96a2371
commit 9e99158b63
3 changed files with 3 additions and 4 deletions

View File

@@ -1,5 +1,3 @@
version: '3.8'
services: services:
# Redis para cache de artículos # Redis para cache de artículos
redis: redis:

View File

@@ -16,7 +16,7 @@ const PROJECT_ROOT = process.env.PROJECT_ROOT || join(__dirname, '../..');
const app = express(); const app = express();
const server = createServer(app); const server = createServer(app);
const wss = new WebSocketServer({ server }); const wss = new WebSocketServer({ server, path: '/ws' });
app.use(cors()); app.use(cors());
app.use(express.json()); app.use(express.json());

View File

@@ -73,8 +73,9 @@ onUnmounted(() => {
}); });
function connectWebSocket() { function connectWebSocket() {
// Use relative path so Vite proxy can handle it
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsUrl = `${protocol}//${window.location.hostname}:3001`; const wsUrl = `${protocol}//${window.location.host}/ws`;
ws = new WebSocket(wsUrl); ws = new WebSocket(wsUrl);