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>
This commit is contained in:
parent
1bd56ee46d
commit
afb8971569
1 changed files with 2 additions and 0 deletions
|
|
@ -133,6 +133,7 @@ export class StreamableHTTPServerTransport implements Transport {
|
|||
|
||||
sessionId?: string;
|
||||
onclose?: () => void;
|
||||
ondelete?: (sessionId: string) => void;
|
||||
onerror?: (error: Error) => void;
|
||||
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
|
||||
|
||||
|
|
@ -538,6 +539,7 @@ export class StreamableHTTPServerTransport implements Transport {
|
|||
if (!this.validateProtocolVersion(req, res)) {
|
||||
return;
|
||||
}
|
||||
this.ondelete?.(this.sessionId!);
|
||||
await this.close();
|
||||
res.writeHead(200).end();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue