enable static method

void enable({
  1. int maxConnections = 50,
  2. int maxEventsPerConnection = 100,
})

Enable WebSocket interception Preserves existing connections and events across hot reloads

Implementation

static void enable({int maxConnections = 50, int maxEventsPerConnection = 100}) {
  // Don't clear data if already enabled (preserves data across hot reloads)
  if (_enabled) {
    _maxConnections = maxConnections;
    _maxEventsPerConnection = maxEventsPerConnection;
    return;
  }
  _enabled = true;
  _maxConnections = maxConnections;
  _maxEventsPerConnection = maxEventsPerConnection;
  // Note: _connections and _allEvents preserve their data across hot reloads
  // because static variables persist unless explicitly cleared
}