ioConnectionFactory function

ConnectionFactory ioConnectionFactory({
  1. SecurityContext? securityContext,
  2. bool onBadCertificate(
    1. X509Certificate cert,
    2. String host,
    3. int port
    )?,
  3. Duration? pingInterval,
})

Builds a dart:io ConnectionFactory with explicit TLS trust overrides.

This is where the SecurityContext / onBadCertificate knobs that used to live on ClientConfig now reside — keeping ClientConfig itself free of dart:io types so it can be compiled to the browser. Native callers (the CLI, the test harness) pass the result to ClientConfig.connectionFactory.

Implementation

ConnectionFactory ioConnectionFactory({
  SecurityContext? securityContext,
  bool Function(X509Certificate cert, String host, int port)? onBadCertificate,
  Duration? pingInterval,
}) =>
    (Uri uri, {Map<String, String>? headers}) => WebSocketConnection.connect(
      uri,
      headers: headers,
      securityContext: securityContext,
      onBadCertificate: onBadCertificate,
      pingInterval: pingInterval,
    );