mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-09 22:25:33 -05:00
cleanup when running onClose
This commit is contained in:
@@ -281,9 +281,14 @@ export class McpClient {
|
||||
/**
|
||||
* Register a callback to be invoked when the underlying transport closes.
|
||||
* Used by the connection manager for reconnection logic.
|
||||
* Chains with the SDK's internal onclose handler so it still performs its cleanup.
|
||||
*/
|
||||
onClose(callback: () => void): void {
|
||||
this.transport.onclose = callback
|
||||
const existingHandler = this.transport.onclose
|
||||
this.transport.onclose = () => {
|
||||
existingHandler?.()
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user