MCPcopy Create free account
hub / github.com/CommE2E/comm / handleAPIRequestClientSocketMessage

Method handleAPIRequestClientSocketMessage

keyserver/src/socket/socket.js:572–590  ·  view source on GitHub ↗
(
    message: APIRequestClientSocketMessage,
  )

Source from the content-addressed store, hash-verified

570 }
571
572 async handleAPIRequestClientSocketMessage(
573 message: APIRequestClientSocketMessage,
574 ): Promise<ServerServerSocketMessage[]> {
575 if (!endpointIsSocketSafe(message.payload.endpoint)) {
576 throw new ServerError('endpoint_unsafe_for_socket');
577 }
578 const { viewer } = this;
579 invariant(viewer, 'should be set');
580 const responder = jsonEndpoints[message.payload.endpoint];
581 await policiesValidator(viewer, responder.requiredPolicies);
582 const response = await responder.responder(viewer, message.payload.input);
583 return [
584 {
585 type: serverSocketMessageTypes.API_RESPONSE,
586 responseTo: message.id,
587 payload: response,
588 },
589 ];
590 }
591
592 onRedisMessage = async (message: RedisMessage) => {
593 try {

Callers 1

Calls 2

endpointIsSocketSafeFunction · 0.90
policiesValidatorFunction · 0.90

Tested by

no test coverage detected