MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / handle

Function handle

apps/app-server/src/utils/websocket-endpoints.ts:64–104  ·  view source on GitHub ↗
(message: Buffer)

Source from the content-addressed store, hash-verified

62 redlockSignals,
63
64 async handle(message: Buffer) {
65 try {
66 moduleLogger.info('Received message %d', step);
67
68 const input_ = (
69 input.procedures[step - 1][0]._def.inputs[0] as any
70 ).parse(unpack(message));
71
72 if (step === 1) {
73 await input.acquireLocks(input_);
74 }
75
76 const output = await input.procedures[step - 1][1]({
77 ctx: input.ctx,
78 input: input_,
79 });
80
81 checkRedlockSignalAborted(redlockSignals);
82
83 moduleLogger.info('Sending message %d', step);
84
85 input.connection.socket.send(
86 pack({
87 success: true,
88
89 output,
90 }),
91 );
92
93 if (step === input.procedures.length) {
94 input.connection.end();
95 finishPromise.resolve();
96
97 moduleLogger.info('Finished websocket request');
98 }
99
100 step++;
101 } catch (error: any) {
102 finishPromise.reject(String(error?.message ?? error));
103 }
104 },
105 };
106}
107

Callers

nothing calls this directly

Calls 2

sendMethod · 0.80

Tested by

no test coverage detected