MCPcopy
hub / github.com/DO-SAY-GO/dn / send

Function send

src/protocol.js:78–95  ·  view source on GitHub ↗
(method, params = {}, sessionId)

Source from the content-addressed store, hash-verified

76 };
77
78 async function send(method, params = {}, sessionId) {
79 const message = {
80 method, params, sessionId,
81 id: ++id
82 };
83 if ( ! sessionId ) {
84 delete message[sessionId];
85 }
86 const key = `${sessionId||ROOT_SESSION}:${message.id}`;
87 let resolve;
88 const promise = new Promise(res => resolve = res);
89 Resolvers[key] = resolve;
90 const outGoing = JSON.stringify(message);
91 MESSAGES.set(key, outGoing);
92 socket.send(outGoing);
93 DEBUG.verboseSlow && (SHOW_FETCH || !method.startsWith('Fetch')) && console.log("Sent", message);
94 return promise;
95 }
96
97 async function handle(message) {
98 if ( typeof message !== "string" ) {

Callers 8

collectFunction · 0.85
reloadIfNotLiveFunction · 0.85
installForSessionFunction · 0.85
indexURLFunction · 0.85
attachToTargetFunction · 0.85
cacheRequestFunction · 0.85
getBodyFunction · 0.85
archiveAndIndexURLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected