YamuxStream class

A Yamux stream that implements the P2PStream and MuxedStream interfaces

Implemented types

Constructors

YamuxStream({required int id, required String protocol, required Map<String, dynamic>? metadata, required int initialWindowSize, required Future<void> sendFrame(YamuxFrame frame), required Conn parentConn, required PeerId remotePeer, required int maxFrameSize, YamuxMetricsObserver? metricsObserver, String? logPrefix})

Properties

conn Conn
Returns the connection this stream is part of
no setteroverride
currentRemoteReceiveWindow int
no setter
hashCode int
The hash code for this object.
no setterinherited
incoming P2PStream<Uint8List>
Returns a Dart Stream of the incoming data
no setteroverride
isClosed bool
Returns true if the stream is closed
no setteroverride
isWritable bool
Returns true if the stream is ready for writing More precise than !isClosed as it excludes closing state
no setteroverride
metadata Map<String, dynamic>
Stream metadata
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
streamId int
The stream ID
final
streamProtocol String
The protocol ID associated with this stream
getter/setter pair
streamState YamuxStreamState
no setter

Methods

close() Future<void>
Closes the stream for both reading and writing
override
closeRead() Future<void>
Closes the stream for reading but leaves it open for writing
override
closeWrite() Future<void>
Closes the stream for writing but leaves it open for reading
override
forceReset() Future<void>
Forces the stream into reset state without sending frames (e.g., called by session on its own closure)
handleFrame(YamuxFrame frame) Future<void>
id() String
Returns an identifier that uniquely identifies this Stream within this host, during this run. Stream IDs may repeat across restarts.
override
initialWindowSentBySession(int windowSize) → void
Called by session when it sends an initial window update for this stream.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open() Future<void>
Opens the stream (called by session when creating a new stream locally or accepting one)
protocol() String
Returns the protocol ID associated with this stream
override
pushData(Uint8List data) → void
Pushes data to the front of the incoming queue, so the next read() returns it. Used to inject leftover bytes after multistream-select negotiation.
read([int? maxLength]) Future<Uint8List>
Reads data from the stream
override
reset() Future<void>
Closes both ends of the stream
override
scope() StreamManagementScope
Returns the management view of this stream's resource scope
override
setDeadline(DateTime? time) Future<void>
Sets a deadline for both reading and writing operations
override
setProtocol(String id) Future<void>
Sets the protocol for this stream
override
setReadDeadline(DateTime time) Future<void>
Sets a deadline for reading operations
override
setWriteDeadline(DateTime time) Future<void>
Sets a deadline for writing operations
override
stat() StreamStats
Returns metadata pertaining to this stream
override
toString() String
A string representation of this object.
inherited
write(List<int> data) Future<void>
Writes data to the stream
override

Operators

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