Browse Source

fix: expose WebSocket globally for node runtime

helium3@sina.com 5 hours ago
parent
commit
8da27497e0
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/modules/ComponentInitializer.ts

+ 5 - 0
src/modules/ComponentInitializer.ts

@@ -7,6 +7,11 @@ import Logger from '../utils/Logger';
 import { DeltaStrategyConfig } from './ConfigurationManager';
 import WebSocket from 'ws';
 
+// Ensure WebSocket is available globally when running under Node.js
+if (typeof globalThis.WebSocket === 'undefined') {
+  (globalThis as any).WebSocket = WebSocket;
+}
+
 // Sprint 1 Components
 import { OrderLifecycleManager, LifecycleConfig } from '../services/OrderLifecycleManager';
 import { PricingEngine, PricingConfig } from '../services/PricingEngine';