Pass requestId to handlers via metadata
This commit is contained in:
parent
09e5d5b450
commit
ec23b71f4e
1 changed files with 170 additions and 0 deletions
|
|
@ -115,6 +115,12 @@ export type RequestHandlerExtra<SendRequestT extends Request,
|
|||
*/
|
||||
sessionId?: string;
|
||||
|
||||
/**
|
||||
* The JSON-RPC ID of the request being handled.
|
||||
* This can be useful for tracking or logging purposes.
|
||||
*/
|
||||
requestId: RequestId;
|
||||
|
||||
/**
|
||||
* Sends a notification that relates to the current request being handled.
|
||||
*
|
||||
|
|
@ -361,6 +367,7 @@ export abstract class Protocol<
|
|||
sendRequest: (r, resultSchema, options?) =>
|
||||
this.request(r, resultSchema, { ...options, relatedRequestId: request.id }),
|
||||
authInfo: extra?.authInfo,
|
||||
requestId: request.id,
|
||||
};
|
||||
|
||||
// Starting with Promise.resolve() puts any synchronous errors into the monad as well.
|
||||
|
|
|
|||
Loading…
Reference in a new issue