Initializes the StreamingManager with its configuration. This method must be called successfully before any other operations.
The configuration for the manager.
A promise that resolves upon successful initialization.
If configuration is invalid or initialization fails.
Creates a new data stream and returns its unique ID.
Optional requestedStreamId: stringOptional. If provided, attempts to use this ID. If not provided or if the ID already exists, a new unique ID will be generated.
A promise resolving to the unique ID of the created stream.
If the maximum number of concurrent streams is reached,
or if a requestedStreamId is provided but already in use (and regeneration is not supported/fails).
Registers a client to a specific stream to receive data chunks.
The ID of the stream to subscribe to.
The client instance that implements IStreamClient.
A promise that resolves when the client is successfully registered.
If the stream does not exist, if the client is already registered, or if the maximum number of clients for the stream is reached.
Deregisters a client from a specific stream. The client will no longer receive data chunks for this stream.
The ID of the stream to unsubscribe from.
The ID of the client to deregister.
A promise that resolves when the client is successfully deregistered.
If the stream or client does not exist within that stream.
Pushes a data chunk to all clients currently subscribed to the specified stream.
The ID of the stream to push data to.
The data chunk to distribute.
A promise that resolves when the chunk has been pushed to all
active clients of the stream (or attempted, based on onClientSendErrorBehavior).
If the stream does not exist, or if onClientSendErrorBehavior is 'throw'
and a client send fails.
Closes a specific stream. All subscribed clients will be notified and subsequently deregistered. No further data can be pushed to a closed stream.
The ID of the stream to close.
Optional reason: stringAn optional reason for closing the stream.
A promise that resolves when the stream is closed and clients are notified.
If the stream does not exist.
Handles an error that occurred on a specific stream. This might involve notifying clients with an error chunk and/or closing the stream.
The ID of the stream where the error occurred.
The error object.
If true, the stream will be closed after processing the error.
A promise that resolves when the error has been handled.
If the stream does not exist.
Readonly manager
StreamingManager
Implements
Manages real-time data streams for AgentOS, handling client subscriptions and chunk distribution.