MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / pollRpc

Function pollRpc

scripts/studio-host-provider.mjs:322–341  ·  view source on GitHub ↗
(config, state)

Source from the content-addressed store, hash-verified

320}
321
322async function pollRpc(config, state) {
323 const response = await studioJson(
324 config,
325 "/api/actions/provider-hosts/rpc/next",
326 {
327 hostId: config.hostId,
328 hostToken: config.hostToken,
329 },
330 );
331 if (!response?.request) {
332 return;
333 }
334 const task = handleRpc(config, response.request).catch((error) => {
335 console.error(
336 `[simdeck-provider] rpc ${response.request.id} failed: ${describeError(error)}`,
337 );
338 });
339 state.activeRequests.add(task);
340 task.finally(() => state.activeRequests.delete(task));
341}
342
343async function handleRpc(config, request) {
344 if (isWebSocketUpgradeRequest(request)) {

Callers 1

runFunction · 0.85

Calls 5

studioJsonFunction · 0.85
handleRpcFunction · 0.85
errorMethod · 0.80
describeErrorFunction · 0.70
deleteMethod · 0.65

Tested by

no test coverage detected