WsStreamMixin<T extends NetworkStreamConfig, M extends IMessage<IMessageType> > mixin
Shared behaviour for WebSocket-backed streams.
Publishing is a frame to the hub; subscribing is a subscribe control
frame that installs a route there. No isolate and no polling: unlike
liblsl, a WebSocket is already non-blocking and event-driven.
- Superclass constraints
- NetworkStream<
T, M>
- NetworkStream<
- Mixin applications
Properties
- carriesSenderClock → bool
-
Whether this transport already puts the sender's clock on the wire.
no setterinherited
- channelCount → int
-
Number of channels in the stream.
no setterinherited
-
clockSyncs
→ Stream<
ClockSyncSample> -
Clock-offset estimates for this stream's peers, as they are made.
no setterinherited
- config → T
-
Configuration for the stream.
This is a NetworkStreamConfig object.
finalinherited
- connection → WsConnection
-
no setter
-
consumers
→ List<
String> -
List of consumer node IDs.
no setterinherited
- created → bool
-
Indicates whether the ILifecycle implementation has been created.
no setteroverride
- dataType → StreamDataType
-
Data type of the stream.
This is a StreamDataType enum value.
no setterinherited
- description → String?
-
Returns a description of the identity.
no setterinherited
- descriptor → PeerDescriptor
-
no setter
- disposed → bool
-
Indicates whether the ILifecycle implementation has been disposed.
no setteroverride
- endpointId → String
-
no setter
- hasConsumers → bool
-
Whether the stream has any current consumers.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasProducers → bool
-
Whether the stream has any current producers.
no setterinherited
- id → String
-
Identifier for the stream, derived from the config hash code.
no setterinherited
-
inbox
→ Stream<
M> -
Incoming messages from peers.
no setteroverride
- manager → IResourceManager?
-
gets the resource manager that manages this resource
no setteroverride
- messageClass → Type
-
no setterinherited
- name → String
-
Human-readable name for the stream.
no setterinherited
-
outbox
→ StreamSink<
M> -
no setteroverride
-
outletConsumerPresence
→ Stream<
bool> -
Emits when this stream's publishing endpoint gains or loses every
subscriber, where the transport can tell.
no setterinherited
- paused → bool
-
no setterinherited
-
producers
→ List<
String> -
List of producer node IDs.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sampleRate → double
-
Sample rate of the stream.
no setterinherited
- sessionName → String
-
no setter
-
Whether both ends of this stream read the same PeerClock.
no setterinherited
- started → bool
-
Whether the stream is currently running.
no setteroverride
- streamNode → Node
-
no setter
- uId → String
-
Returns a unique identifier that is guaranteed to be globally unique.
no setterinherited
Methods
-
addConsumer(
Node consumer) → void -
Adds a consumer node to this stream.
inherited
-
addInlet(
PeerHandle handle) → Future< void> -
Subscribes to a peer found by discovery.
override
-
addProducer(
Node producer) → void -
Adds a producer node to this stream.
inherited
-
create(
) → Future< void> -
Creates.
override
-
createInletsForNodes(
Iterable< Node> nodes, {Duration resolveTimeout = const Duration(seconds: 10)}) → Future<void> -
Subscribes to every node in
nodes, resolving their endpoints first.override -
createOutlet(
) → Future< void> -
Creates this node's publishing endpoint.
override
-
decodeControlPayload(
Object payload) → M? - Builds a message from a relayed JSON payload.
-
decodeSample(
Uint8List frame) → M? - Builds a message from a binary sample frame. Null for streams that do not carry samples.
-
destroyStream(
) → Future< void> -
Stops and releases the stream's endpoints.
override
-
dispose(
) → Future< void> -
Disposes the ILifecycle implementation, releasing any resources.
override
-
encodeForWire(
M message) → Object -
JSON-encodable form of
messagefor the control path. -
flushStreams(
) → Future< void> -
Discards anything buffered.
inherited
-
isConsumer(
Node node) → bool -
Checks if a given node is a consumer for this stream.
inherited
-
isProducer(
Node node) → bool -
Checks if a given node is a producer for this stream.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pause(
) → FutureOr< void> -
Pauses the implementation.
inherited
-
pauseStream(
) → Future< void> -
Pauses, if running and not already paused.
inherited
-
publishSample(
List< Object?> channels) → void - Publishes a sample using the binary framing.
-
recreateOutlet(
) → Future< void> -
Recreates the publishing endpoint to reflect a changed Node.
override
-
removeInlet(
String nodeUId) → Future< void> -
Unsubscribes from a peer, releasing whatever that inlet holds.
override
-
resume(
) → FutureOr< void> -
Resumes the implementation.
inherited
-
resumeStream(
{bool flushBeforeResume = true}) → Future< void> -
Resumes, if running and paused.
inherited
-
resumeWith(
{bool flushBeforeResume = true}) → Future< void> -
Resumes, optionally discarding data buffered while paused.
inherited
-
sendMessage(
M message) → FutureOr< void> -
override
-
setStreamNode(
Node node) → void -
start(
) → Future< void> -
Begins publishing and delivering. Idempotent.
override
-
stop(
) → Future< void> -
Stops publishing and delivering, but keeps the stream usable.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateManager(
IResourceManager? newManager) → void -
override
-
updateNode(
Node newNode) → void -
Replaces the Node this stream publishes as.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited