Skip to content

Commit

Permalink
Fix ctx.signal documentation (#260)
Browse files Browse the repository at this point in the history
## 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

<!-- Kind reminder to add tests and updated documentation if needed -->
  • Loading branch information
masad-frost authored Aug 26, 2024
1 parent 06b23e2 commit 61a07b3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion router/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ export type ProcedureHandlerContext<State> = 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).
*
Expand Down

0 comments on commit 61a07b3

Please sign in to comment.