diff --git a/src/lib/session.ts b/src/lib/session.ts index e675821..4f74330 100644 --- a/src/lib/session.ts +++ b/src/lib/session.ts @@ -2,8 +2,14 @@ import { EventEmitter } from 'stream'; import { applyPatch } from 'rfc6902'; import { Block } from './types'; +const sessions = + (global as any)._sessionManagerSessions || new Map(); +if (process.env.NODE_ENV !== 'production') { + (global as any)._sessionManagerSessions = sessions; +} + class SessionManager { - private static sessions = new Map(); + private static sessions: Map = sessions; readonly id: string; private blocks = new Map(); private events: { event: string; data: any }[] = [];