WebSocketPool constructor

WebSocketPool({
  1. required List<WebSocketConfig> configs,
  2. PoolStrategy strategy = PoolStrategy.roundRobin,
  3. WebSocketAdapter adapterFactory(
    1. WebSocketConfig
    )?,
})

Implementation

WebSocketPool({
  required List<WebSocketConfig> configs,
  this.strategy = PoolStrategy.roundRobin,
  /// Optional factory to create adapters; defaults to [WebSocketChannelAdapter].
  WebSocketAdapter Function(WebSocketConfig)? adapterFactory,
}) : _entries = configs.map((c) {
        final adapter =
            adapterFactory?.call(c) ?? WebSocketChannelAdapter(c);
        return _PoolEntry(WebSocketClient(adapter));
      }).toList();