IO-2935-Add-Enhanced-Websocket-Provider - fixes

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-09-24 20:54:14 -04:00
parent 103d7c2bb2
commit 82e2e332cf
5 changed files with 22 additions and 17 deletions

View File

@@ -11,6 +11,7 @@ const { createAdapter } = require("@socket.io/redis-adapter");
const logger = require("./server/utils/logger");
const { redisSocketEvents } = require("./server/web-sockets/redisSocketEvents");
const { instrument, RedisStore } = require("@socket.io/admin-ui");
const { isString, isEmpty } = require("lodash");
const applyRedisHelpers = require("./server/utils/redisHelpers");
@@ -27,6 +28,7 @@ const SOCKETIO_CORS_ORIGIN = [
"https://test.imex.online",
"https://www.test.imex.online",
"http://localhost:3000",
"https://localhost:3000",
"https://imex.online",
"https://www.imex.online",
"https://romeonline.io",
@@ -46,7 +48,9 @@ const SOCKETIO_CORS_ORIGIN = [
"https://old.imex.online",
"https://www.old.imex.online",
"https://wsadmin.imex.online",
"https://www.wsadmin.imex.online"
"https://www.wsadmin.imex.online",
"http://localhost:3333",
"https://localhost:3333"
];
/**
@@ -58,8 +62,13 @@ const applyMiddleware = (app) => {
app.use(cookieParser());
app.use(bodyParser.json({ limit: "50mb" }));
app.use(bodyParser.urlencoded({ limit: "50mb", extended: true }));
app.use(cors({ credentials: true, exposedHeaders: ["set-cookie"] }));
app.use(
cors({
origin: SOCKETIO_CORS_ORIGIN,
credentials: true,
exposedHeaders: ["set-cookie"]
})
);
// Helper middleware
app.use((req, res, next) => {
req.logger = logger;
@@ -142,7 +151,6 @@ const applySocketIO = async (server, app) => {
username: "admin",
password: process.env.REDIS_ADMIN_PASS
},
store: new RedisStore(pubClient),
mode: process.env.REDIS_ADMIN_MODE || "development"
});
}