From 63ab4360e311ec45d70051db887dddb5eecf296f Mon Sep 17 00:00:00 2001 From: Rohit Rajan Date: Sun, 24 Aug 2025 15:18:46 +0530 Subject: [PATCH] feat: init browser pool and io shared instance --- src/shared/instances.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/shared/instances.ts diff --git a/src/shared/instances.ts b/src/shared/instances.ts new file mode 100644 index 00000000..b855ad4f --- /dev/null +++ b/src/shared/instances.ts @@ -0,0 +1,21 @@ +import { BrowserPool } from "../../server/src/browser-management/classes/BrowserPool" +import { Server } from "socket.io"; +import http from 'http'; + +/** + * Shared browser pool instance + */ +export const browserPool = new BrowserPool(); + +/** + * Shared socket.io instance - will be initialized by the main server + */ +export let io: Server; + +/** + * Initialize the socket.io instance (called only by main server) + */ +export function initializeSocketIO(server: http.Server): Server { + io = new Server(server); + return io; +} \ No newline at end of file