RequestContextImpl
Defined in: packages/client/src/request-context.ts:20
Internal implementation of RequestContext.
Passed to method handlers to allow sending responses. All response methods are async to properly handle socket backpressure.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RequestContextImpl(
requestId,method,_methodId,_codec,_socket,_abortCallbacks,_acquireHeader,_drainWaiter):RequestContextImpl
Defined in: packages/client/src/request-context.ts:24
Parameters
Section titled “Parameters”requestId
Section titled “requestId”number
method
Section titled “method”string
_methodId
Section titled “_methodId”number
_codec
Section titled “_codec”Codec
_socket
Section titled “_socket”Socket
_abortCallbacks
Section titled “_abortCallbacks”Map<number, Set<() => void>>
_acquireHeader
Section titled “_acquireHeader”() => Buffer
_drainWaiter
Section titled “_drainWaiter”DrainWaiter
Returns
Section titled “Returns”RequestContextImpl
Properties
Section titled “Properties”method
Section titled “method”
readonlymethod:string
Defined in: packages/client/src/request-context.ts:26
Method name being handled
Implementation of
Section titled “Implementation of”requestId
Section titled “requestId”
readonlyrequestId:number
Defined in: packages/client/src/request-context.ts:25
Request ID for correlation
Implementation of
Section titled “Implementation of”Accessors
Section titled “Accessors”aborted
Section titled “aborted”Get Signature
Section titled “Get Signature”get aborted():
boolean
Defined in: packages/client/src/request-context.ts:35
Was request aborted by parent?
Returns
Section titled “Returns”boolean
Was request aborted by parent?
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”ack(
data?):Promise<void>
Defined in: packages/client/src/request-context.ts:63
Send acknowledgment to parent. Sets IS_RESPONSE | IS_ACK flags.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Promise<void>
Promise that resolves when the response has been written and socket buffer has drained (if backpressure occurred).
Implementation of
Section titled “Implementation of”chunk()
Section titled “chunk()”chunk(
data):Promise<void>
Defined in: packages/client/src/request-context.ts:73
Send stream chunk to parent. Sets IS_RESPONSE | IS_STREAM flags.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Promise<void>
Promise that resolves when the chunk has been written and socket buffer has drained (if backpressure occurred).
Implementation of
Section titled “Implementation of”end():
Promise<void>
Defined in: packages/client/src/request-context.ts:77
End stream. Sets IS_RESPONSE | IS_STREAM | STREAM_END flags.
Returns
Section titled “Returns”Promise<void>
Promise that resolves when the end marker has been written and socket buffer has drained (if backpressure occurred).
Implementation of
Section titled “Implementation of”error()
Section titled “error()”error(
err):Promise<void>
Defined in: packages/client/src/request-context.ts:87
Send error response to parent. Sets IS_RESPONSE | IS_ERROR flags.
Parameters
Section titled “Parameters”string | Error
Returns
Section titled “Returns”Promise<void>
Promise that resolves when the error has been written and socket buffer has drained (if backpressure occurred).
Implementation of
Section titled “Implementation of”onAbort()
Section titled “onAbort()”onAbort(
callback):void
Defined in: packages/client/src/request-context.ts:47
Register callback to be called when request is aborted.
Parameters
Section titled “Parameters”callback
Section titled “callback”() => void
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”respond()
Section titled “respond()”respond(
data):Promise<void>
Defined in: packages/client/src/request-context.ts:56
Send full response to parent. Sets IS_RESPONSE flag.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Promise<void>
Promise that resolves when the response has been written and socket buffer has drained (if backpressure occurred).