feat: add closeSSEStream callback to RequestHandlerExtra (#1166)
This commit is contained in:
parent
6c863c8e75
commit
fab7e1e9b3
1 changed files with 147 additions and 11 deletions
|
|
@ -283,6 +283,13 @@ export type RequestHandlerExtra<SendRequestT extends Request, SendNotificationT
|
|||
* This is used by certain transports to correctly associate related messages.
|
||||
*/
|
||||
sendRequest: <U extends AnySchema>(request: SendRequestT, resultSchema: U, options?: TaskRequestOptions) => Promise<SchemaOutput<U>>;
|
||||
|
||||
/**
|
||||
* Closes the SSE stream for this request, triggering client reconnection.
|
||||
* Only available when using StreamableHTTPServerTransport with eventStore configured.
|
||||
* Use this to implement polling behavior during long-running operations.
|
||||
*/
|
||||
closeSSEStream?: () => void;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -728,7 +735,8 @@ export abstract class Protocol<SendRequestT extends Request, SendNotificationT e
|
|||
requestInfo: extra?.requestInfo,
|
||||
taskId: relatedTaskId,
|
||||
taskStore: taskStore,
|
||||
taskRequestedTtl: taskCreationParams?.ttl
|
||||
taskRequestedTtl: taskCreationParams?.ttl,
|
||||
closeSSEStream: extra?.closeSSEStream
|
||||
};
|
||||
|
||||
// Starting with Promise.resolve() puts any synchronous errors into the monad as well.
|
||||
|
|
|
|||
Loading…
Reference in a new issue