Skip to main content

Function: toReadableStream()

function toReadableStream(stream: AsyncGenerator<SessionState, any, unknown>, keepAliveDelay: number): ReadableStream<any>

Generate a Server-Sent-Event ReadableStream from a generator returned by client.runStream.

Parameters

ParameterTypeDescription

stream

AsyncGenerator<SessionState, any, unknown>

An async generator returned by client.runStream

keepAliveDelay

number

The delay in milliseconds to send keep-alive messages. Default is 1 minute.

Returns

ReadableStream<any>

A ReadableStream object