Derive a remote proxy whose calls use per-call timeout and/or AbortSignal overrides, without changing the channel default.
timeout
AbortSignal
const api = wrap<RemoteAPI>(transport)const quick = withCallOptions(api, { timeout: 2000 })await quick.slowThing() // rejects after 2s instead of the channel timeoutconst controller = new AbortController()const cancelable = withCallOptions(api, { signal: controller.signal })cancelable.longRunning().catch(() => {})controller.abort() Copy
const api = wrap<RemoteAPI>(transport)const quick = withCallOptions(api, { timeout: 2000 })await quick.slowThing() // rejects after 2s instead of the channel timeoutconst controller = new AbortController()const cancelable = withCallOptions(api, { signal: controller.signal })cancelable.longRunning().catch(() => {})controller.abort()
The options apply to every call made through the returned proxy (and nested property proxies derived from it). Throws if the value is not a kkrpc remote proxy.
Derive a remote proxy whose calls use per-call
timeoutand/orAbortSignaloverrides, without changing the channel default.The options apply to every call made through the returned proxy (and nested property proxies derived from it). Throws if the value is not a kkrpc remote proxy.