Update WebSocket configuration and clean up docker-compose
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# Redis para cache de artículos
|
||||
redis:
|
||||
|
||||
@@ -16,7 +16,7 @@ const PROJECT_ROOT = process.env.PROJECT_ROOT || join(__dirname, '../..');
|
||||
|
||||
const app = express();
|
||||
const server = createServer(app);
|
||||
const wss = new WebSocketServer({ server });
|
||||
const wss = new WebSocketServer({ server, path: '/ws' });
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
@@ -73,8 +73,9 @@ onUnmounted(() => {
|
||||
});
|
||||
|
||||
function connectWebSocket() {
|
||||
// Use relative path so Vite proxy can handle it
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user