grpc-node/packages/grpc-js
Michael Lumish 440d985f1f
Merge pull request #1397 from murgatroid99/grpc-js_pre_xds_internal_changes
grpc-js: Some internal changes in preparation for implementing xDS Global LB
2020-04-27 14:52:42 -07:00
..
src Merge pull request #1397 from murgatroid99/grpc-js_pre_xds_internal_changes 2020-04-27 14:52:42 -07:00
test fix: make stream.write() synchronous in server-call 2020-04-22 13:58:26 -07:00
.eslintrc grpc-js: Fix how package.json is loaded 2020-04-14 13:58:12 -07:00
LICENSE Don't fill in any templates in LICENSE files 2019-03-06 11:01:44 -08:00
README.md grpc-js: Add "Migrating from grpc" README section 2020-04-20 15:08:28 -07:00
gulpfile.ts grpc-js: skip gulp tasks based on Node version 2019-05-18 11:25:06 -04:00
package.json Bump grpc-js to 1.0.3 2020-04-24 10:13:17 -07:00
prettier.config.js build: add full gts configuration and fix TSLint issues 2019-11-07 22:14:24 +01:00
tsconfig.json grpc-js: resolve node/no-unpublished-require 2020-04-12 17:20:28 +02:00

README.md

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

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 using grpc.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 using grpc.loadPackageDefinition.
  • If you are currently loading packages generated by grpc-tools, you should instead generate your files using the --generate_package_definitions option in grpc-tools, then load the object exported by the generated file into @grpc/grpc-js using grpc.loadPackageDefinition.
  • If you have a server and you are using Server#bind to bind ports, you will need to use Server#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.