ConnectionManager class

Manages multiple peer connections with health monitoring and reconnection

Available extensions

Constructors

ConnectionManager({required BitcoinNetwork network, ConnectionManagerConfig? config, Logger? logger})

Properties

config ConnectionManagerConfig
final
connectionAdded Stream<PeerConnection>
Event streams
no setter
connectionCount int
Current number of connections
no setter
connectionIds List<String>
List of all connection identifiers
no setter
connectionRemoved Stream<PeerConnection>
no setter
errorStream Stream<NetworkException>
no setter
hashCode int
The hash code for this object.
no setterinherited
isShutdown bool
Whether manager is shutdown
no setter
logger → Logger
final
messageStream Stream<WireMessage>
no setter
network BitcoinNetwork
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addConnection(String address, int port, {PeerConnectionConfig? connectionConfig}) Future<PeerConnection>
Add a new peer connection
addConnections(List<String> addresses, int port) Future<List<PeerConnection>>

Available on ConnectionManager, provided by the ConnectionManagerExtensions extension

Add connections from a list of addresses
broadcastMessage(WireMessage message) Future<List<String>>
Send a message to all connected peers
getActiveConnections() List<PeerConnection>
Get all active connections
getBestConnection() PeerConnection?
Get best connection for a request (based on health and load)
getConnection(String connectionId) PeerConnection?
Get a connection by ID
getStatistics() Map<String, dynamic>
Get connection statistics
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeAllConnections() Future<void>

Available on ConnectionManager, provided by the ConnectionManagerExtensions extension

Remove all connections
removeConnection(String connectionId) Future<void>
Remove a peer connection
sendMessageToPeer(String connectionId, WireMessage message) Future<void>
Send a message to a specific peer
shutdown() Future<void>
Shutdown the connection manager
toString() String
A string representation of this object.
inherited

Operators

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