TypeScript SDKFeature Clients

StreamsTypeScript SDK

Streams Client

StreamsClient publishes to and reads from durable topics. Unlike runs.subscribeToStream, topics are stored, independent of any run, and readers can resume from a cursor.

Methods

events()

Yields topic's messages after options.cursor, or from the oldest retained (or, once the topic is reset, after the reset). If the connection drops, it resubscribes from the last message yielded, so nothing is skipped or repeated. Ends when the server hangs up an idle subscription, options.signal aborts, or the caller stops iterating; throws on errors a retry can't fix, such as an expired cursor.

Parameters

ParameterTypeDescription
topicstringthe topic to read from
options?StreamCallOptionsoptional namespace override, resume cursor, and abort signal

Returns

AsyncIterable<StreamEvent>

publish()

Resolves once the message is stored. A client's messages to a topic are delivered in the order publish() was called.

Parameters

ParameterTypeDescription
topicstringthe topic to publish to
messagestring | Uint8Array<ArrayBufferLike>the message payload
options?StreamCallOptionsoptional namespace override

Returns

Promise<void>

reset()

Makes events() calls without a cursor start after the topic's latest message. Readers already iterating, and any call with a cursor, are unaffected.

Parameters

ParameterTypeDescription
topicstringthe topic to reset
options?Pick<StreamCallOptions, "namespace">optional namespace override

Returns

Promise<void>

topicMetadata()

Describes topic's retained messages. Rejects with a NOT_FOUND gRPC error for a topic nothing was published to.

Parameters

ParameterTypeDescription
topicstringthe topic to describe
options?Pick<StreamCallOptions, "namespace">optional namespace override

Returns

Promise<StreamTopicMetadata>

Type Aliases

StreamCallOptions

type StreamCallOptions = object;

Per-call options of the durable stream calls; the same shape on the core and Node clients.

Properties

PropertyTypeDescription
cursor?stringResumes an events() iteration right after this message.
namespace?stringThe topic's namespace; the empty namespace when omitted.
signal?AbortSignalEnds an events() iteration cleanly, without throwing; aborts a unary call.

StreamTopicMetadata

type StreamTopicMetadata = object;

What a durable stream topic retains; counts and the latest message cover the tenant's retention.

Properties

PropertyTypeDescription
lastPublishedAt?DateWhen the newest retained message was stored; undefined when none is retained.
latestCursor?stringResumes events() after the newest retained message; undefined when none is retained.

Last updated on October 22, 2026

On this page