Skip to content

RequestContext

Defined in: packages/client/src/types.ts:64

Request context passed to method handlers.

Provides methods to send responses back to parent.

All response methods are async to properly handle backpressure. Always await these methods to prevent deadlocks with large payloads.

readonly aborted: boolean

Defined in: packages/client/src/types.ts:72

Was request aborted by parent?


readonly method: string

Defined in: packages/client/src/types.ts:69

Method name being handled


readonly requestId: number

Defined in: packages/client/src/types.ts:66

Request ID for correlation

ack(data?): Promise<void>

Defined in: packages/client/src/types.ts:95

Send acknowledgment to parent. Sets IS_RESPONSE | IS_ACK flags.

unknown

Promise<void>

Promise that resolves when the response has been written and socket buffer has drained (if backpressure occurred).


chunk(data): Promise<void>

Defined in: packages/client/src/types.ts:104

Send stream chunk to parent. Sets IS_RESPONSE | IS_STREAM flags.

unknown

Promise<void>

Promise that resolves when the chunk has been written and socket buffer has drained (if backpressure occurred).


end(): Promise<void>

Defined in: packages/client/src/types.ts:113

End stream. Sets IS_RESPONSE | IS_STREAM | STREAM_END flags.

Promise<void>

Promise that resolves when the end marker has been written and socket buffer has drained (if backpressure occurred).


error(err): Promise<void>

Defined in: packages/client/src/types.ts:122

Send error response to parent. Sets IS_RESPONSE | IS_ERROR flags.

string | Error

Promise<void>

Promise that resolves when the error has been written and socket buffer has drained (if backpressure occurred).


onAbort(callback): void

Defined in: packages/client/src/types.ts:77

Register callback to be called when request is aborted.

() => void

void


respond(data): Promise<void>

Defined in: packages/client/src/types.ts:86

Send full response to parent. Sets IS_RESPONSE flag.

unknown

Promise<void>

Promise that resolves when the response has been written and socket buffer has drained (if backpressure occurred).