WebSocketTransport class

Coordination over a WebSocket relay hub.

Works on the VM and in the browser: package:web_socket_channel presents one API over both, and nothing here touches dart:io. Run the hub with package:peer_coordinator/hub.dart (server-side) or dart run peer_coordinator:hub.

Every stream on a node shares one socket; endpoints are demultiplexed by the hub-assigned slot carried in each frame.

Inheritance
Implemented types

Properties

clockOffsets → PeerClockOffsets
Peer clock offsets for this process.
final
config → WebSocketTransportConfig
final
connection → WsConnection
The socket this node holds to the hub.
no setter
created → bool
Indicates whether the ILifecycle implementation has been created.
no setterinherited
description → String
Returns a description of the identity.
no setteroverride
disposed → bool
Indicates whether the ILifecycle implementation has been disposed.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
id → String
Returns a unique identifier for the identity.
finalinherited
initialized → bool
Indicates whether the required initialization has been completed.
no setteroverride
localNodeUId ← String
Set by PeerSession before initialize.
no getteroverride
manager → IResourceManager?
gets the resource manager that manages this resource
no setterinherited
name → String
Returns a human-readable name for the identity.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shadowUId ↔ String?
getter/setter pairinherited
streamFactory → NetworkStreamFactory<CoordinationSession>
Builds this transport's streams.
no setteroverride
uId → String
Returns a unique identifier that is guaranteed to be globally unique.
no setterinherited

Methods

create() → FutureOr<void>
Marks the resource created.
inherited
createDiscovery({required NetworkStreamConfig streamConfig, required CoordinationConfig coordinationConfig, required String id}) → Future<IDiscovery>
Creates a discovery instance for finding peers on this transport.
override
dispose() → Future<void>
Disposes the ILifecycle implementation, releasing any resources.
override
initialize() → Future<void>
Initializes the lifecycle, preparing it for use.
override
manageResource<R extends IResource>(R resource) → void
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
releaseResource<R extends IResource>(String resourceId) → Future<R>
override
toString() → String
A string representation of this object.
inherited
updateManager(IResourceManager? newManager) → void
inherited

Operators

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