MCPcopy Create free account
hub / github.com/PleasureTools/joyBox / Call

Method Call

src/Common/RpcClient.ts:55–68  ·  view source on GitHub ↗

* Call remote function. throw * @param method method name * @param args arguments passed to method

(method: string, ...args: Args)

Source from the content-addressed store, hash-verified

53 * @param args arguments passed to method
54 */
55 protected async Call<Args extends any[], Ret>(method: string, ...args: Args): Promise<Ret> {
56 return new Promise((resolve, reject) => {
57 const req: Request = { method, callId: this.GetCallId(), args };
58
59 this.socket.emit(this.RPC, req);
60
61 const timeoutTimer = setTimeout(() => {
62 this.RemovePendingRequest(req.callId);
63 reject(new Error(`Method call '${method}' timed out.`));
64 }, this.responseTimeout);
65
66 this.pendingRequests.push({ callId: req.callId, timeoutTimer, fn: resolve });
67 });
68 }
69}

Callers 15

AddObservableMethod · 0.45
RemoveObservableMethod · 0.45
ReorderPluginMethod · 0.45
EnablePluginMethod · 0.45
StopRecordingMethod · 0.45
RemoveArchiveRecordMethod · 0.45
AddArchiveFilterMethod · 0.45
RemoveArchiveFilterMethod · 0.45
AddObservablesFilterMethod · 0.45

Calls 2

GetCallIdMethod · 0.95
RemovePendingRequestMethod · 0.95

Tested by

no test coverage detected