Example Javascript Client Using Generated GRPC API



Example Javascript Client Using Generated GRPC API#

This sample script utilizes @grpc/proto-loader to dynamically load .proto files at runtime, and @grpc/grpc-js to implement gRPC functionality for Node.js.


Node 12+ is recommended


Clone the triton-inference-server/common repository:

git clone https://github.com/triton-inference-server/common/ -b <common-repo-branch> common-repo

<common-repo-branch> should be the version of the Triton server that you intend to use (e.g. r21.05).

Copy *.proto files to ./proto

mkdir proto
cp common-repo/protobuf/*.proto ./proto/

Install dependencies with

npm install

Finally, run with

node client.js <host> <port>
  • host is the server where triton inference server is running. Default is localhost.

  • port is the grpc port of triton inference server. Default is 8001.