Static Client Example - AkashBabu/lib-grpc-client-pool GitHub Wiki
For usage with statically generated code (protobuf) file:
import GRPCClient from 'grpc-pool'
const PROTO_FILE_PATH = path.join(__dirname, 'test/hello_grpc_pb');
const client = new GRPCClient(PROTO_FILE_PATH, {
maxConnections : 2,
rpcPrefix : 'RPC',
serviceName : 'Greeting',
url : 'localhost:50001',
staticFile : true,
});
const { RPC_Hi } = client;
const request = new messages.Request();
request.setMsg('Hi');
const res = await RPC_Hi(request);
console.log(res.getResp()); // 'Hello'