跳到主要内容

Stream

查看 Markdown

This page lists the TypeScript SDK names for Streams. The doc comment of each API gives its parameters, defaults, and errors. Read them in the TypeScript SDK API reference.

API names​

TaskTypeScript APIDex behavior
Define a Stream and its byte capacityStream, with streamCapacityBytesCapacity and trimming
Declare it in the Flowstreams of the PersistenceSchema returned from getPersistenceSchemaFlow definition
Write a message from a StepStream.writeWrite semantics
Write text chunks in batches from a StepStream.bufferedTextBuffer text chunks
Write a message from a ClientClient.writeStreamWrite semantics
Read the next messageClient.readStream, with the resumeToken of the last messageResumable reads
List retained messages, newest firstClient.listStreamMessagesList messages

Stream.write works in waitFor, execute, and the Flow timeout handler. An RPC handler cannot write a Stream. Stream.write sends the message immediately and returns nothing. Use Stream.bufferedText in an asynchronous Step.

Example​

Example: examples/typescript/src/primitives/stream/stream-flow.ts