Outbound streams are opened by the local node, inbound streams are opened by the remote
Unique identifier for a stream. Identifiers are not unique across muxers.
Readonly
logThe stream logger
User defined stream metadata
Optional
nameOptional
protocolThe protocol negotiated for this stream
The current status of the readable end of the stream
The current status of the stream
Lifecycle times for the stream
The current status of the writable end of the stream
Optional
err: ErrorOptional
err: ErrorOptional
err: ErrorClose immediately for reading and writing and send a reset message (local error)
Closes the stream for reading and writing.
Any buffered data in the source can still be consumed and the stream will end normally.
This will cause a CLOSE
message to be sent to the remote, unless the sink has already ended.
The sink and the source will return normally.
Optional
options: AbortOptionsCloses the stream for reading. If iterating over the source of this stream in a for await of
loop, it will return (exit the loop) after any buffered data has been consumed.
This function is called automatically by the muxer when it receives a CLOSE
message from the remote.
The source will return normally, the sink will continue to consume.
Optional
options: AbortOptionsCloses the stream for writing. If iterating over the source of this stream in a for await of
loop, it will return (exit the loop) after any buffered data has been consumed.
The source will return normally, the sink will continue to consume.
Optional
options: AbortOptionsThe underlying muxer has closed, no more messages can be sent or will be received, close immediately to free up resources
handleData is called when the stream receives a data frame
handleWindowUpdate is called when the stream receives a window update frame
Protected
onOptional
err: ErrorProtected
onOptional
err: ErrorThe remote closed for reading so we should not send any more messages
The remote closed for writing so we should expect to receive no more messages
Receive a reset message - close immediately for reading and writing (remote error)
Send a message to the remote muxer, informing them no more data messages will be read by this end of the stream
Send a message to the remote muxer, informing them no more data messages will be sent by this end of the stream
Send a data message to the remote muxer
Send a message to the remote muxer informing them a new stream is being opened.
This is a noop for Yamux because the first window update is sent when .newStream is called on the muxer which opens the stream on the remote.
Send a reset message to the remote muxer
potentially sends a window update enabling further writes to take place.
When an extending class reads data from it's implementation-specific source, call this method to allow the stream consumer to read the data.
Returns the amount of unread data - can be used to prevent large amounts of data building up when the stream consumer is too slow.
Wait for the send window to be non-zero
Will throw with ERR_STREAM_ABORT if the stream gets aborted
YamuxStream is used to represent a logical stream within a session