Package Exports
- @grpc/grpc-js
- @grpc/grpc-js/build/src/auth-context
- @grpc/grpc-js/build/src/auth-context.js
- @grpc/grpc-js/build/src/backoff-timeout
- @grpc/grpc-js/build/src/backoff-timeout.js
- @grpc/grpc-js/build/src/call
- @grpc/grpc-js/build/src/call-credentials
- @grpc/grpc-js/build/src/call-credentials.js
- @grpc/grpc-js/build/src/call-interface.js
- @grpc/grpc-js/build/src/call.js
- @grpc/grpc-js/build/src/channel
- @grpc/grpc-js/build/src/channel-credentials.js
- @grpc/grpc-js/build/src/channel.js
- @grpc/grpc-js/build/src/client-interceptors
- @grpc/grpc-js/build/src/client-interceptors.js
- @grpc/grpc-js/build/src/compression-algorithms
- @grpc/grpc-js/build/src/compression-algorithms.js
- @grpc/grpc-js/build/src/compression-filter
- @grpc/grpc-js/build/src/compression-filter.js
- @grpc/grpc-js/build/src/connectivity-state
- @grpc/grpc-js/build/src/connectivity-state.js
- @grpc/grpc-js/build/src/constants
- @grpc/grpc-js/build/src/constants.js
- @grpc/grpc-js/build/src/deadline
- @grpc/grpc-js/build/src/deadline.js
- @grpc/grpc-js/build/src/experimental
- @grpc/grpc-js/build/src/experimental.js
- @grpc/grpc-js/build/src/index.js
- @grpc/grpc-js/build/src/load-balancer
- @grpc/grpc-js/build/src/load-balancer.js
- @grpc/grpc-js/build/src/logging
- @grpc/grpc-js/build/src/logging.js
- @grpc/grpc-js/build/src/make-client
- @grpc/grpc-js/build/src/make-client.js
- @grpc/grpc-js/build/src/metadata
- @grpc/grpc-js/build/src/metadata.js
- @grpc/grpc-js/build/src/object-stream
- @grpc/grpc-js/build/src/object-stream.js
- @grpc/grpc-js/build/src/resolver
- @grpc/grpc-js/build/src/resolver.js
- @grpc/grpc-js/build/src/server-call
- @grpc/grpc-js/build/src/server-call.js
- @grpc/grpc-js/build/src/service-config
- @grpc/grpc-js/build/src/service-config.js
- @grpc/grpc-js/build/src/uri-parser
- @grpc/grpc-js/build/src/uri-parser.js
- @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-jsDocumentation
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 compress and decompress messages, and servers can decompress request messages
- Pick first and round robin load balancing policies
- Client Interceptors
- Connection Keepalives
- HTTP Connect support (proxies)
If you need a feature from the grpc package that is not provided by the @grpc/grpc-js, please file a feature request with that information.
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
.protofiles usinggrpc.load, that function is not available in this library. You should instead load your.protofiles using@grpc/proto-loaderand load the resulting package definition objects into@grpc/grpc-jsusinggrpc.loadPackageDefinition. - If you are currently loading packages generated by
grpc-tools, you should instead generate your files using thegenerate_package_definitionoption ingrpc-tools, then load the object exported by the generated file into@grpc/grpc-jsusinggrpc.loadPackageDefinition. - If you have a server and you are using
Server#bindto bind ports, you will need to useServer#bindAsyncinstead. - If you are using any channel options supported in
grpcbut not supported in@grpc/grpc-js, you may need to adjust your code to handle the different behavior. Refer to the list of supported options below. - Refer to the detailed package comparison for more details on the differences between
grpcand@grpc/grpc-js.
Supported Channel Options
Many channel arguments supported in grpc are not supported in @grpc/grpc-js. The channel arguments supported by @grpc/grpc-js are:
grpc.ssl_target_name_overridegrpc.primary_user_agentgrpc.secondary_user_agentgrpc.default_authoritygrpc.keepalive_time_msgrpc.keepalive_timeout_msgrpc.keepalive_permit_without_callsgrpc.service_configgrpc.max_concurrent_streamsgrpc.initial_reconnect_backoff_msgrpc.max_reconnect_backoff_msgrpc.use_local_subchannel_poolgrpc.max_send_message_lengthgrpc.max_receive_message_lengthgrpc.enable_http_proxygrpc.default_compression_algorithmgrpc.enable_channelzgrpc.dns_min_time_between_resolutions_msgrpc.enable_retriesgrpc.max_connection_age_msgrpc.max_connection_age_grace_msgrpc.max_connection_idle_msgrpc.per_rpc_retry_buffer_sizegrpc.retry_buffer_sizegrpc.service_config_disable_resolutiongrpc.client_idle_timeout_msgrpc-node.max_session_memorygrpc-node.tls_enable_tracegrpc-node.retry_max_attempts_limitgrpc-node.flow_control_windowchannelOverridechannelFactoryOverride
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
Callis 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
grpclibrary is likely an error and should not be considered part of the public API. - The
grpc.experimentalnamespace contains APIs that have not stabilized. Any API in that namespace may break in any minor version update.