How to use the @grpc/grpc-js.makeClientConstructor function in @grpc/grpc-js

To help you get started, we’ve selected a few @grpc/grpc-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / burrow / js / src / lib / burrow.ts View on Github external
function newClient(pkg: string, service: string, URL: string): T {
  const imp = require(`../../proto/${pkg}_grpc_pb`);
  // As per https://github.com/agreatfool/grpc_tools_node_protoc_ts/blob/master/examples/src/grpcjs/client.ts
  const cons = makeClientConstructor(imp[`${pkg}.${service}`], service);
  // ugh
  return new cons(URL, grpc.credentials.createInsecure()) as unknown as T
}