ws-asyncapi API / core / StreamRegistry
Class: StreamRegistry
Defined in: .api-entries/core/index.d.ts:442
Server-side bookkeeping for active streams on one connection.
Each client.stream(name, input) opens a stream identified by a client-minted id. The server runs the channel's async-generator handler and pushes each yielded value as a import("./wire.ts").Frame.StreamData frame. This tracks the in-flight streams so a client cancel (StreamStop) or a disconnect can abort them — the handler's signal fires and its generator is return()-ed, so a try/finally cleans up. One instance per connection.
Constructors
Constructor
new StreamRegistry():
StreamRegistry
Returns
StreamRegistry
Methods
add()
add(
streamId):AbortSignal
Defined in: .api-entries/core/index.d.ts:445
Register a new stream and return the signal handed to its handler.
Parameters
streamId
number
Returns
AbortSignal
stop()
stop(
streamId):void
Defined in: .api-entries/core/index.d.ts:447
Cancel one stream (client StreamStop).
Parameters
streamId
number
Returns
void
done()
done(
streamId):void
Defined in: .api-entries/core/index.d.ts:449
Mark a stream finished (handler completed/failed) — no abort.
Parameters
streamId
number
Returns
void
abortAll()
abortAll():
void
Defined in: .api-entries/core/index.d.ts:451
Cancel every active stream (on disconnect).
Returns
void