ConnectionPoolManager class

Manages a pool of WebSocket connections with connection reuse, limits, and lifecycle management.

Constructors

ConnectionPoolManager({required NostrLogger logger, int maxConnectionsPerRelay = 5, int maxIdleTimeSeconds = 300})
Manages a pool of WebSocket connections with connection reuse, limits, and lifecycle management.

Properties

hashCode int
The hash code for this object.
no setterinherited
logger NostrLogger
final
maxConnectionsPerRelay int
Maximum concurrent connections per relay.
final
maxIdleTimeSeconds int
Maximum idle time before closing a connection (in seconds).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

acquireConnection(String relayUrl) Future<PooledConnection?>
Get or create a connection from the pool.
closeAllConnections() Future<void>
Close all connections in the pool.
closeAllConnectionsForRelay(String relayUrl) Future<void>
Close all connections for a relay.
closeConnection(PooledConnection connection) Future<void>
Close a specific connection and remove it from the pool.
dispose() → void
Dispose the manager and clean up resources.
getStatistics() ConnectionPoolStatistics
Get connection pool statistics.
initialize() → void
Initialize the connection pool manager.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
releaseConnection(PooledConnection connection) → void
Release a connection back to the pool.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited