CoordinationHub class

A role-blind relay.

The hub holds a PeerRegistry and a RelayRouting table and nothing else. It does not know what a coordinator is, never inspects a coordination message, and never parses a data sample — election, membership and stream lifecycle all stay client-side, exactly as they are over LSL.

That is what keeps the relay cheap: a data frame costs one two-byte in-place write and a forward per subscriber.

Properties

connectionCount → int
Number of authenticated clients.
no setter
endpointCount → int
Number of registered endpoints across all clients.
no setter
epoch → int
The current session generation.
no setter
hashCode → int
The hash code for this object.
no setterinherited
limits → WsLimits
Resource limits. Fixed for the hub's lifetime — WsLimits.maxFrameBytes in particular is handed to the WebSocket upgrade per connection and cannot change under a live socket.
final
pendingCount → int
Sockets that have connected but not yet authenticated.
no setter
port → int
The port the hub is listening on.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sessionName → String
The one session this hub hosts.
no setter
status → HubSessionStatus
no setter
uri → Uri
Where clients should point a WebSocketTransportConfig.
no setter

Methods

close() → Future<void>
Stops the hub and closes every connection.
endSession({String reason = 'session ended'}) → Future<void>
Ends the session: disconnects every peer and refuses new ones.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openSession({required String secret, Duration? ttl}) → void
Reopens the hub as a new session generation.
revoke(String nodeUId, {String reason = 'revoked'}) → Future<void>
Bars one node for the rest of this epoch, and disconnects it now.
subscribersFor({required String streamName, required String producerEndpointId}) → Set<String>
The subscribers this hub would relay producerEndpointId's stream to.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

serve({required HubCredentials credentials, InternetAddress? address, int port = 0, WsLimits limits = const WsLimits(), Duration? sessionTtl}) → Future<CoordinationHub>
Starts a hub for one session.