monitorConnection method

void monitorConnection(
  1. dynamic connection
)

Monitor connection through existing error propagation and lifecycle events This is transport-agnostic and works with any connection type

Implementation

void monitorConnection(dynamic connection) {
  if (connection == null) return;

  try {
    _logger.fine('Setting up transport-agnostic connection health monitoring');

    // Monitor connection closure through onClose future if available
    _monitorConnectionClosure(connection);

    // Monitor through existing error patterns in stream operations
    // This will be handled in SwarmConn.newStream() where we already
    // record success/error based on stream creation results

  } catch (e) {
    _logger.warning('Error setting up connection monitoring: $e');
  }
}