Skip to content

Commit afb8971

Browse files
Add ondelete hook to StreamableHTTPServerTransport
Adds optional ondelete callback that fires when DELETE request is received, providing the sessionId for cleanup handling. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1bd56ee commit afb8971

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/server/streamableHttp.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export class StreamableHTTPServerTransport implements Transport {
133133

134134
sessionId?: string;
135135
onclose?: () => void;
136+
ondelete?: (sessionId: string) => void;
136137
onerror?: (error: Error) => void;
137138
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
138139

@@ -538,6 +539,7 @@ export class StreamableHTTPServerTransport implements Transport {
538539
if (!this.validateProtocolVersion(req, res)) {
539540
return;
540541
}
542+
this.ondelete?.(this.sessionId!);
541543
await this.close();
542544
res.writeHead(200).end();
543545
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy