ConnectionContext class

Context information for a connection that enables correlation of events across all layers of the protocol stack.

For relay connections, there are two levels:

  • Outer connection: Direct connection to the relay server
  • Inner connection: End-to-end connection through the relay to remote peer

Constructors

ConnectionContext({String? connectionId, required String remotePeerId, required String connectionType, DateTime? establishedAt, String? outerConnectionId, String? sessionId, String? relayPeerId, int? hopStreamId, String? transportConnectionId})
ConnectionContext.direct({required String remotePeerId, String? transportConnectionId})
Create context for a direct connection
factory
ConnectionContext.relayInner({required String remotePeerId, required String outerConnectionId, required String relayPeerId, String? sessionId, int? hopStreamId})
Create context for an inner relay connection (through relay to remote peer)
factory
ConnectionContext.relayOuter({required String relayPeerId, String? transportConnectionId})
Create context for an outer relay connection (to relay server)
factory

Properties

connectionId String
Unique identifier for this connection
final
connectionType String
Type of connection: 'direct' or 'relay'
final
establishedAt DateTime
Timestamp when connection was established
final
hashCode int
The hash code for this object.
no setterinherited
hopStreamId int?
Yamux stream ID of the HOP stream (for relay inner connections)
final
outerConnectionId String?
For relay inner connections: the outer connection ID (to relay server)
final
relayPeerId String?
Relay server peer ID (for relay connections)
final
remotePeerId String
Remote peer ID (base58)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionId String?
Cross-node correlation ID for relay sessions
final
transportConnectionId String?
Underlying transport connection ID (e.g., UDX CID)
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Convert to JSON for transmission/storage
toString() String
A string representation of this object.
override

Operators

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