From 2d7b63b4cf3d5baaa7f229d4669f3d464dba2685 Mon Sep 17 00:00:00 2001 From: mikiher Date: Tue, 15 Oct 2024 05:50:23 +0300 Subject: [PATCH] Add base path to socket.io connections on client and server --- client/layouts/default.vue | 3 ++- server/SocketAuthority.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/layouts/default.vue b/client/layouts/default.vue index 95f8560d..9121561e 100644 --- a/client/layouts/default.vue +++ b/client/layouts/default.vue @@ -357,7 +357,8 @@ export default { teardown: false, transports: ['websocket'], upgrade: false, - reconnection: true + reconnection: true, + path: `${this.$config.routerBasePath}/socket.io` }) this.$root.socket = this.socket console.log('Socket initialized') diff --git a/server/SocketAuthority.js b/server/SocketAuthority.js index af8204c6..a7182936 100644 --- a/server/SocketAuthority.js +++ b/server/SocketAuthority.js @@ -103,7 +103,8 @@ class SocketAuthority { cors: { origin: '*', methods: ['GET', 'POST'] - } + }, + path: `${global.RouterBasePath}/socket.io` }) this.io.on('connection', (socket) => {