Package Exports
- @grpc/grpc-js
- @grpc/grpc-js/build/src/call
- @grpc/grpc-js/build/src/call-credentials
- @grpc/grpc-js/build/src/channel
- @grpc/grpc-js/build/src/compression-filter
- @grpc/grpc-js/build/src/constants
- @grpc/grpc-js/build/src/experimental
- @grpc/grpc-js/build/src/logging
- @grpc/grpc-js/build/src/make-client
- @grpc/grpc-js/build/src/metadata
- @grpc/grpc-js/build/src/resolver
- @grpc/grpc-js/build/src/uri-parser
- @grpc/grpc-js/package.json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@grpc/grpc-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Pure JavaScript gRPC Client
Installation
Node 12 is recommended. The exact set of compatible Node versions can be found in the engines
field of the package.json
file.
npm install @grpc/grpc-js
Documentation
Documentation specifically for the @grpc/grpc-js
package is currently not available. However, documentation is available for the grpc
package, and the two packages contain mostly the same interface. There are a few notable differences, however, and these differences are noted in the "Migrating from grpc" section below.
Features
- Clients
- Automatic reconnection
- Servers
- Streaming
- Metadata
- Partial compression support: clients can decompress response messages
- Pick first and round robin load balancing policies
- Client Interceptors
- Connection Keepalives
- HTTP Connect support (proxies)
This library does not directly handle .proto
files. To use .proto
files with this library we recommend using the @grpc/proto-loader
package.
Migrating from grpc
@grpc/grpc-js
is almost a drop-in replacement for grpc
, but you may need to make a few code changes to use it:
- If you are currently loading
.proto
files usinggrpc.load
, that function is not available in this library. You should instead load your.proto
files using@grpc/proto-loader
and load the resulting package definition objects into@grpc/grpc-js
usinggrpc.loadPackageDefinition
. - If you are currently loading packages generated by
grpc-tools
, you should instead generate your files using thegenerate_package_definition
option ingrpc-tools
, then load the object exported by the generated file into@grpc/grpc-js
usinggrpc.loadPackageDefinition
. - If you have a server and you are using
Server#bind
to bind ports, you will need to useServer#bindAsync
instead.
Some Notes on API Guarantees
The public API of this library follows semantic versioning, with some caveats:
- Some methods are prefixed with an underscore. These methods are internal and should not be considered part of the public API.
- The class
Call
is only exposed due to limitations of TypeScript. It should not be considered part of the public API. - In general, any API that is exposed by this library but is not exposed by the
grpc
library is likely an error and should not be considered part of the public API. - The
grpc.experimental
namespace contains APIs that have not stabilized. Any API in that namespace may break in any minor version update.