MCPcopy Index your code
hub / github.com/hydro-dev/Hydro / message

Method message

framework/framework/api.ts:247–265  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

245 }
246
247 async message(message) {
248 if (!this.isRpc) throw new BadRequestError('Only RPC operations are supported');
249 if (typeof message === 'string') {
250 try {
251 message = JSON.parse(message);
252 } catch (e) {
253 throw new BadRequestError('Invalid message');
254 }
255 }
256 if (!APIS[message.op]) throw new BadRequestError(`Invalid API operation: ${message.op}`);
257 if (APIS[message.op].type !== 'Subscription') {
258 throw new BadRequestError('Only subscription operations are supported');
259 }
260 handleArguments(message);
261 const result = await this.ctx.api.execute(
262 this, message.op, message.args, (m, args) => (this.ctx.parallel as any)(m, args), message.projection,
263 );
264 this.send(result);
265 }
266
267 async cleanup() {
268 await this.dispose?.();

Callers

nothing calls this directly

Calls 3

handleArgumentsFunction · 0.85
executeMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected