
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
grpc-helper
Advanced tools
gRPC helper is an improved gRPC client with lots of helpful features.
npm i grpc-helper --save
or
yarn add grpc-helper
const helper = new GRPCHelper({
packageName: 'helloworld',
serviceName: 'Greeter',
protoPath: path.resolve(__dirname, './hello.proto'),
// intervalMs will determine how frequent the resolver lookup the records
sdUri: 'dns://_grpc._tcp.greeter?intervalMs=5000',
});
await helper.waitForReady();
const res = await helper.SayHello({
name: 'foo',
});
const helper = new GRPCHelper({
packageName: 'helloworld',
serviceName: 'Greeter',
protoPath: path.resolve(__dirname, './hello.proto'),
sdUri: 'static://localhost:50051,localhost:50052,localhost:50053',
});
await helper.waitForReady();
const res = await helper.SayHello({
name: 'foo',
});
const helper = new GRPCHelper({
packageName: 'helloworld',
serviceName: 'Greeter',
protoPath: path.resolve(__dirname, './hello.proto'),
sdUri: 'static://localhost:50051',
resolveFullResponse: true,
});
await helper.waitForReady();
const { message, peer, status, metadata } = await helper.SayHello({
name: 'foo',
});
const stream = new stream.PassThrough({ objectMode: true });
const promise = helper.SayMultiHello(stream);
stream.write({
name: 'foo1',
});
stream.write({
name: 'foo2',
});
stream.write({
name: 'foo3',
});
stream.end();
const result = await promise; // { message: 'hello foo1,foo2,foo3' }
const helper = new GRPCHelper({
packageName: 'helloworld',
serviceName: 'Greeter',
protoPath: path.resolve(__dirname, './hello.proto'),
sdUri: 'static://localhost:50051',
retryOpts: {
enable: true,
retries: 5,
bailError(err, attempt) {
// Just for example !!! It will not retry when code is 2
return err.code === 2;
},
},
});
await helper.waitForReady();
await helper.SayHello({
name: 'foo',
});
Please take a look at the test folder for more examples.
This project is licensed under the MIT License - see the LICENSE file for details
FAQs
gRPC helper, an improved gRPC client for grpc-node
The npm package grpc-helper receives a total of 22 weekly downloads. As such, grpc-helper popularity was classified as not popular.
We found that grpc-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.