Update WebSocket configuration and clean up docker-compose
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# Redis para cache de artículos
|
# Redis para cache de artículos
|
||||||
redis:
|
redis:
|
||||||
|
|||||||
@@ -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());
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user