MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / sendMessage

Method sendMessage

src/runtime/adapters/web.ts:455–471  ·  view source on GitHub ↗
(channelId: string, text: string)

Source from the content-addressed store, hash-verified

453 }
454
455 async sendMessage(channelId: string, text: string): Promise<void> {
456 const sockets = this.socketsByChannel.get(channelId);
457 const activeSockets = [...(sockets || [])].filter(
458 (socket) => socket.readyState === socket.OPEN,
459 );
460
461 if (activeSockets.length === 0) {
462 throw new Error(`[Web] No active WebSocket clients for channelId: ${channelId}`);
463 }
464
465 for (const socket of activeSockets) {
466 sendWsEvent(socket, { type: "message_start", role: "assistant" });
467 sendWsEvent(socket, { type: "text_delta", delta: text });
468 sendWsEvent(socket, { type: "message_end", role: "assistant" });
469 socket.send(JSON.stringify({ done: true }));
470 }
471 }
472
473 // -------------------------------------------------------------------------
474 // WebSocket message handler

Callers

nothing calls this directly

Calls 2

sendWsEventFunction · 0.85
sendMethod · 0.45

Tested by

no test coverage detected