ResponseConnection

A scoped Responses WebSocket. Keep one event collector active while sending successive turns.

Properties

Link copied to clipboard
abstract val events: Flow<ResponseStreamEvent>

Single-consumer protocol events. Named streams may interleave; route using streamId. Completing or cancelling collection closes the connection. API errors remain events.

Functions

Link copied to clipboard
abstract suspend fun close()

Closes the connection. Safe to call repeatedly; subsequent sends fail.

Link copied to clipboard
abstract suspend fun create(request: ResponseCreateRequest, streamId: String? = null, generate: Boolean? = null)

Sends a response.create event with request fields at the top level. Sends are serialized. streamId selects a multiplexed conversation lane; generate=false warms up state. Background requests are unsupported on WebSockets and are rejected before sending.

Link copied to clipboard
abstract suspend fun send(event: JsonObject)

Sends an arbitrary protocol event, such as response.steer. Sends are serialized.