GSI - Employe Self Service Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
3.9 KiB

2 months ago
  1. # Pure JavaScript gRPC Client
  2. ## Installation
  3. Node 12 is recommended. The exact set of compatible Node versions can be found in the `engines` field of the `package.json` file.
  4. ```sh
  5. npm install @grpc/grpc-js
  6. ```
  7. ## Documentation
  8. Documentation specifically for the `@grpc/grpc-js` package is currently not available. However, [documentation is available for the `grpc` package](https://grpc.github.io/grpc/node/grpc.html), 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.
  9. ## Features
  10. - Clients
  11. - Automatic reconnection
  12. - Servers
  13. - Streaming
  14. - Metadata
  15. - Partial compression support: clients can decompress response messages
  16. - Pick first and round robin load balancing policies
  17. - Client Interceptors
  18. - Connection Keepalives
  19. - HTTP Connect support (proxies)
  20. 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.
  21. This library does not directly handle `.proto` files. To use `.proto` files with this library we recommend using the `@grpc/proto-loader` package.
  22. ## Migrating from [`grpc`](https://www.npmjs.com/package/grpc)
  23. `@grpc/grpc-js` is almost a drop-in replacement for `grpc`, but you may need to make a few code changes to use it:
  24. - 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`.
  25. - If you are currently loading packages generated by `grpc-tools`, you should instead generate your files using the `generate_package_definition` option in `grpc-tools`, then load the object exported by the generated file into `@grpc/grpc-js` using `grpc.loadPackageDefinition`.
  26. - If you have a server and you are using `Server#bind` to bind ports, you will need to use `Server#bindAsync` instead.
  27. - If you are using any channel options supported in `grpc` but 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](#supported-channel-options) below.
  28. - Refer to the [detailed package comparison](https://github.com/grpc/grpc-node/blob/master/PACKAGE-COMPARISON.md) for more details on the differences between `grpc` and `@grpc/grpc-js`.
  29. ## Supported Channel Options
  30. Many channel arguments supported in `grpc` are not supported in `@grpc/grpc-js`. The channel arguments supported by `@grpc/grpc-js` are:
  31. - `grpc.ssl_target_name_override`
  32. - `grpc.primary_user_agent`
  33. - `grpc.secondary_user_agent`
  34. - `grpc.default_authority`
  35. - `grpc.keepalive_time_ms`
  36. - `grpc.keepalive_timeout_ms`
  37. - `grpc.keepalive_permit_without_calls`
  38. - `grpc.service_config`
  39. - `grpc.max_concurrent_streams`
  40. - `grpc.initial_reconnect_backoff_ms`
  41. - `grpc.max_reconnect_backoff_ms`
  42. - `grpc.use_local_subchannel_pool`
  43. - `grpc.max_send_message_length`
  44. - `grpc.max_receive_message_length`
  45. - `grpc.enable_http_proxy`
  46. - `grpc.default_compression_algorithm`
  47. - `grpc.enable_channelz`
  48. - `grpc.dns_min_time_between_resolutions_ms`
  49. - `grpc-node.max_session_memory`
  50. - `channelOverride`
  51. - `channelFactoryOverride`
  52. ## Some Notes on API Guarantees
  53. The public API of this library follows semantic versioning, with some caveats:
  54. - Some methods are prefixed with an underscore. These methods are internal and should not be considered part of the public API.
  55. - The class `Call` is only exposed due to limitations of TypeScript. It should not be considered part of the public API.
  56. - 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.
  57. - The `grpc.experimental` namespace contains APIs that have not stabilized. Any API in that namespace may break in any minor version update.