gRPC Client

Complete guide for integrating with NCN Network using gRPC.


Overview

gRPC provides:

  • High performance binary protocol

  • Streaming support

  • Strong typing via Protocol Buffers

  • Auto-generated client code


Generate Client Code

Python

# Install dependencies
pip install grpcio grpcio-tools

# Generate Python code
python -m grpc_tools.protoc \
  -I./proto \
  --python_out=./client \
  --grpc_python_out=./client \
  proto/common_types.proto

Go

JavaScript/TypeScript

Rust

Rust clients are built-in. Use the common_types crate:


Connection Setup

Python

Go

JavaScript

Rust


Submit Inference Request

Python

Go

JavaScript

Rust


Subscribe to Results (Streaming)

Python

Go

JavaScript

Rust


Error Handling

gRPC Status Codes

Code
Name
Description

0

OK

Success

1

CANCELLED

Operation cancelled

3

INVALID_ARGUMENT

Bad request

5

NOT_FOUND

Resource not found

8

RESOURCE_EXHAUSTED

Rate limited

13

INTERNAL

Server error

14

UNAVAILABLE

Service unavailable

Python Error Handling

Go Error Handling


Retry Logic

Python with Retry


Connection Pooling

Python


Full Example

Python Complete Client


Next Steps

Last updated