MCPcopy Create free account
hub / github.com/echoVic/blade-code / disconnect

Method disconnect

src/mcp/client/MCPClient.ts:81–100  ·  view source on GitHub ↗

* 断开连接

(sessionId: string)

Source from the content-addressed store, hash-verified

79 * 断开连接
80 */
81 async disconnect(sessionId: string): Promise<void> {
82 const session = this.sessions.get(sessionId);
83 const connection = this.connections.get(sessionId);
84
85 if (session) {
86 session.connected = false;
87 }
88
89 if (connection) {
90 if (connection instanceof WebSocket) {
91 connection.close();
92 } else if (connection.kill) {
93 connection.kill();
94 }
95 this.connections.delete(sessionId);
96 }
97
98 this.sessions.delete(sessionId);
99 this.emit('disconnected', sessionId);
100 }
101
102 /**
103 * 获取所有会话

Callers 3

mcpCommandFunction · 0.95
destroyMethod · 0.80
disconnectFromServerMethod · 0.80

Calls 3

getMethod · 0.80
deleteMethod · 0.80
emitMethod · 0.45

Tested by

no test coverage detected