From 61a07b3fe25cc63e2ae4d7a5da1529e83088ea4b Mon Sep 17 00:00:00 2001 From: Faris Masad Date: Mon, 26 Aug 2024 10:28:41 -0700 Subject: [PATCH] Fix ctx.signal documentation (#260) ## Why It didn't make sense, and wasn't clear. ## What changed Update docs Maybe worth considering renaming to "invocationFinishedSignal" or something more verbose, as signals in JavaScript are typically used in context of cancellation. ## Versioning - [ ] Breaking protocol change - [ ] Breaking ts/js API change --- router/context.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/router/context.ts b/router/context.ts index add07d4d..3fc9066c 100644 --- a/router/context.ts +++ b/router/context.ts @@ -73,7 +73,12 @@ export type ProcedureHandlerContext = ServiceContext & { /** * This signal is a standard [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) * triggered when the procedure invocation is done. This signal tracks the invocation/request finishing - * for _any_ reason including the procedure invocation. + * for _any_ reason, for example: + * - client explicit cancellation + * - procedure handler explicit cancellation via {@link cancel} + * - client session disconnect + * - server cancellation due to client invalid payload + * - invocation finishes cleanly, this depends on the type of the procedure (i.e. rpc handler return, or in a stream after the client-side has closed the request writable and the server-side has closed the response writable) * * You can use this to pass it on to asynchronous operations (such as fetch). *