PeerDescriptor class

A peer discovered on the network, described in transport-neutral terms.

Every transport resolves peers in its own way — LSL by multicast-resolving stream metadata, a WebSocket hub by listing connected clients — but they all produce the same facts, and DiscoveryQuery filters on exactly these fields.

Constructors

PeerDescriptor({required String streamName, required String sessionName, required String nodeId, required String nodeUId, required String nodeRole, required String endpointId, Set<String> capabilities = const {}, double? randomRoll, String? startedAt, Map<String, String> extra = const {}})
const
PeerDescriptor.forNode({required Node node, required String streamName, required String sessionName, String? endpointId, Map<String, String> extra = const {}})
Builds the descriptor a node publishes for one of its own streams.
factory
PeerDescriptor.fromJson(Map<String, dynamic> json)
factory
PeerDescriptor.fromSourceId(String sourceId, {Map<String, String> desc = const {}, Map<String, String> extra = const {}})
Parses the LSL source_id encoding.
factory

Properties

capabilities → Set<String>
Capabilities the node declares it could take on, which is not the same as the role it currently holds.
final
endpointId → String
Stable per-endpoint dedupe key.
final
extra → Map<String, String>
Transport-specific extras (hostname, ports, connection id, ...).
final
hashCode → int
The hash code for this object.
no setteroverride
isCoordinator → bool
Whether this peer holds the coordinator role right now.
no setter
nodeId → String
Human-facing node id. Not guaranteed unique — use nodeUId for identity.
final
nodeRole → String
Current role, as NodeCapability.shortString.
final
nodeUId → String
The node's unique identity. This is the key everything else joins on.
final
randomRoll → double?
Election tie-breaker; null if the peer did not publish one.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sessionName → String
Session the peer belongs to. Peers in other sessions are not ours.
final
startedAt → String?
ISO-8601 start time. Lexicographic order is chronological order.
final
streamName → String
Name of the stream this peer publishes (coordination, TestData, ...).
final

Methods

copyWith({String? nodeRole, Map<String, String>? extra}) → PeerDescriptor
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
toSourceId() → String
The legacy LSL source_id encoding: stream//role//uId//nodeId.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

assertSourceIdSafe(String value, String what) → void
Throws if value cannot survive the positional source_id encoding.