Registry / testing / grpc-client

grpc-client

JSON →
library0.1.4jsnpmunverified

A simple wrapper for gRPC client in Node.js (v0.1.4, last release 2016). It provides a fluent API to load proto files and make gRPC calls with promise-based responses. Minimal maintenance; only one release. Simpler than @grpc/grpc-js but outdated and not actively supported.

npm install grpc-client
INSTALL
IMPORT
SIG · GRPC-CLIENT
G
grpc-client
testingjavascriptv0.1.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gRPCClient (default)
var grpcClient = require('grpc-client');
import grpcClient from 'grpc-client';
CommonJS only; no ESM support. The library exports a constructor function directly.
instance methods
var gc = new grpcClient({host: 'localhost:50051', dir: './'});
var gc = grpcClient({host: 'localhost:50051', dir: './'});
Must use 'new' keyword to instantiate the client.

Initialize gRPC client, load a proto file, and make a unary RPC call with promise handling.

var grpcClient = require('grpc-client'); var gc = new grpcClient({host: "localhost:50051", dir: './', header: {custom: ['customvalue']}}); gc.proto("helloworld") .sayHello({name:"xing"}) .then(function(res){ console.log(res); }) .catch(function(err){ console.log(err); });
Debug
Known issues
deprecatedPackage is unmaintained; use @grpc/grpc-js instead.
fix
Replace with @grpc/grpc-js which is actively maintained.
affects: >=0.0.0
breakingDependency 'grpc' (the legacy gRPC package) has breaking changes with newer Node versions.
fix
Migrate to @grpc/grpc-js which is pure JS and works with Node >= 8.
affects: >=0.0.0
gotchaThe 'header' option expects an object with string arrays, e.g., {custom: ['value']}.
fix
Ensure headers are passed as an object with array values.
affects: >=0.1.4
Errors
Common errors & fixes
Cannot find module 'grpc-client'
Package not installed or npm install failed.
fix
Run npm install grpc-client --save
TypeError: grpcClient is not a constructor
Using the module without 'new' keyword.
fix
Use var gc = new grpcClient(options);
Error: ENOENT: no such file or directory, open '...'
Proto file not found in the specified directory.
fix
Verify the 'dir' option points to the correct folder containing .proto files.
Upgrade
Version history
0.1.4latest on npm
Audit
Dependencies
grpcrequiredCore gRPC library for Node.js
Agent activity
11 hits · last 30 days
node
10
Resources
grpc-client — npm install grpc-client · libregistry