File tree Expand file tree Collapse file tree 3 files changed +14
-28
lines changed Expand file tree Collapse file tree 3 files changed +14
-28
lines changed Original file line number Diff line number Diff line change @@ -23,17 +23,20 @@ export class StreamableHTTPError extends Error {
23
23
/**
24
24
* Options for starting or authenticating an SSE connection
25
25
*/
26
- export interface StartSSEOptions {
26
+ interface StartSSEOptions {
27
27
/**
28
28
* The ID of the last received event, used for resuming a disconnected stream
29
29
*/
30
30
lastEventId ?: string ;
31
+
31
32
/**
32
33
* The callback function that is invoked when the last event ID changes
33
34
*/
34
35
onLastEventIdUpdate ?: ( event : string ) => void
36
+
35
37
/**
36
- * When reconnecting to a long-running SSE stream, we need to make sure that message id matches
38
+ * Override Message ID to associate with the replay message
39
+ * so that response can be associate with the new resumed request.
37
40
*/
38
41
replayMessageId ?: string | number ;
39
42
}
@@ -358,7 +361,7 @@ export class StreamableHTTPClientTransport implements Transport {
358
361
this . onclose ?.( ) ;
359
362
}
360
363
361
- async send ( message : JSONRPCMessage | JSONRPCMessage [ ] , options ?: { resumptionToken ?: string , onresumptiontoken ?: ( event : string ) => void } ) : Promise < void > {
364
+ async send ( message : JSONRPCMessage | JSONRPCMessage [ ] , options ?: { resumptionToken ?: string , onresumptiontoken ?: ( token : string ) => void } ) : Promise < void > {
362
365
try {
363
366
// If client passes in a lastEventId in the request options, we need to reconnect the SSE stream
364
367
const lastEventId = options ?. resumptionToken
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import {
22
22
Result ,
23
23
ServerCapabilities ,
24
24
} from "../types.js" ;
25
- import { Transport } from "./transport.js" ;
25
+ import { Transport , TransportSendOptions } from "./transport.js" ;
26
26
27
27
/**
28
28
* Callback for progress notifications.
@@ -82,26 +82,7 @@ export type RequestOptions = {
82
82
* If not specified, there is no maximum total timeout.
83
83
*/
84
84
maxTotalTimeout ?: number ;
85
-
86
- /**
87
- * May be used to indicate to the transport which incoming request to associate this outgoing request with.
88
- */
89
- relatedRequestId ?: RequestId ;
90
-
91
- /**
92
- * The resumption token used to continue long-running requests that were interrupted.
93
- *
94
- * This allows clients to reconnect and continue from where they left off, if supported by the transport.
95
- */
96
- resumptionToken ?: string ;
97
-
98
- /**
99
- * A callback that is invoked when the resumption token changes, if supported by the transport.
100
- *
101
- * This allows clients to persist the latest token for potential reconnection.
102
- */
103
- onresumptiontoken ?: ( token : string ) => void ;
104
- } ;
85
+ } & TransportSendOptions ;
105
86
106
87
/**
107
88
* Options that can be given per notification.
Original file line number Diff line number Diff line change 1
1
import { JSONRPCMessage , RequestId } from "../types.js" ;
2
2
3
3
/**
4
- * Options for sending a JSON-RPC message.
5
- */
6
- export interface TransportSendOptions {
4
+ * Options for sending a JSON-RPC message.
5
+ */
6
+ export type TransportSendOptions = {
7
7
/**
8
8
* If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.
9
- */
9
+ */
10
10
relatedRequestId ?: RequestId ;
11
+
11
12
/**
12
13
* The resumption token used to continue long-running requests that were interrupted.
13
14
*
14
15
* This allows clients to reconnect and continue from where they left off, if supported by the transport.
15
16
*/
16
17
resumptionToken ?: string ;
18
+
17
19
/**
18
20
* A callback that is invoked when the resumption token changes, if supported by the transport.
19
21
*
You can’t perform that action at this time.
0 commit comments