SwarmConn class

SwarmConn is a connection to a remote peer in the Swarm network.

Implemented types

Constructors

SwarmConn.new({required String id, required Conn conn, required PeerId localPeer, required PeerId remotePeer, required Direction direction, required Swarm swarm, required ConnManagementScope managementScope})
Creates a new SwarmConn

Properties

conn Conn
The underlying transport connection
final
direction Direction
The direction of the connection (inbound or outbound)
final
hashCode int
The hash code for this object.
no setterinherited
healthMetrics ConnectionHealthMetrics
Gets the health metrics for this connection
no setter
healthState ConnectionHealthState
Gets the current health state of this connection
no setter
id String
The connection ID
final
isClosed bool
IsClosed returns whether a connection is fully closed, so it can be garbage collected.
no setteroverride
isHealthy bool
Checks if the connection is healthy using event-driven state
no setter
localMultiaddr MultiAddr
LocalMultiaddr returns the local Multiaddr associated with this connection
no setteroverride
localPeer PeerId
LocalPeer returns our peer ID
no setteroverride
remoteMultiaddr MultiAddr
RemoteMultiaddr returns the remote Multiaddr associated with this connection
no setteroverride
remotePeer PeerId
RemotePeer returns the peer ID of the remote peer.
no setteroverride
remotePublicKey Future<PublicKey?>
RemotePublicKey returns the public key of the remote peer.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scope ConnScope
Scope returns the user view of this connection's resource scope
no setteroverride
stat ConnStats
Stat stores metadata pertaining to this conn.
no setteroverride
state ConnState
ConnState returns information about the connection state.
no setteroverride
streamHandler ↔ void Function(P2PStream stream)?
Handler for incoming streams
getter/setter pair
streams Future<List<P2PStream>>
GetStreams returns all open streams over this conn.
no setteroverride
swarm Swarm
The swarm that owns this connection
final

Methods

close() Future<void>
Closes the connection
override
handleIncomingStream(SwarmStream stream) → void
Handles an incoming stream
newStream(Context context) Future<P2PStream>
Creates a new stream
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeStream(SwarmStream stream) Future<void>
Removes a stream from this connection
toString() String
A string representation of this object.
inherited

Operators

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