File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -136,8 +136,6 @@ export class SSEServerTransport implements Transport {
136136
137137 /**
138138 * Returns the session ID for this transport.
139- *
140- * This can be used to route incoming POST requests.
141139 */
142140 get sessionId ( ) : string {
143141 return this . _sessionId ;
Original file line number Diff line number Diff line change @@ -74,6 +74,11 @@ export type RequestHandlerExtra = {
7474 * An abort signal used to communicate if the request was cancelled from the sender's side.
7575 */
7676 signal : AbortSignal ;
77+
78+ /**
79+ * The session ID from the transport, if available.
80+ */
81+ sessionId ?: string ;
7782} ;
7883
7984/**
@@ -239,9 +244,15 @@ export abstract class Protocol<
239244 const abortController = new AbortController ( ) ;
240245 this . _requestHandlerAbortControllers . set ( request . id , abortController ) ;
241246
247+ // Create extra object with both abort signal and sessionId from transport
248+ const extra : RequestHandlerExtra = {
249+ signal : abortController . signal ,
250+ sessionId : this . _transport ?. sessionId ,
251+ } ;
252+
242253 // Starting with Promise.resolve() puts any synchronous errors into the monad as well.
243254 Promise . resolve ( )
244- . then ( ( ) => handler ( request , { signal : abortController . signal } ) )
255+ . then ( ( ) => handler ( request , extra ) )
245256 . then (
246257 ( result ) => {
247258 if ( abortController . signal . aborted ) {
Original file line number Diff line number Diff line change @@ -41,4 +41,6 @@ export interface Transport {
4141 * Callback for when a message (request or response) is received over the connection.
4242 */
4343 onmessage ?: ( message : JSONRPCMessage ) => void ;
44+
45+ sessionId ?: string ;
4446}
You can’t perform that action at this time.
0 commit comments