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

Method handleMessage

src/mcp/client/MCPClient.ts:189–206  ·  view source on GitHub ↗
(data: any)

Source from the content-addressed store, hash-verified

187 }, session.config.timeout || 30000);
188
189 const handleMessage = (data: any) => {
190 try {
191 const response = typeof data === 'string' ? JSON.parse(data) : data;
192
193 if (response.id === message.id) {
194 clearTimeout(timeout);
195 connection.off?.('message', handleMessage);
196
197 if (response.error) {
198 reject(new Error(response.error.message));
199 } else {
200 resolve(response.result);
201 }
202 }
203 } catch (error) {
204 reject(error);
205 }
206 };
207
208 if (connection instanceof WebSocket) {
209 connection.on('message', handleMessage);

Callers 2

connectWebSocketMethod · 0.95
connectStdioMethod · 0.95

Calls 2

offMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected