tencent cloud

All product documents
Tencent Cloud Observability Platform
Client Overview
Last updated: 2025-03-11 20:04:58
Client Overview
Last updated: 2025-03-11 20:04:58
grpc.Client represents a gRPC client that can interact with a gRPC server.

Constructor

new Client(): Client

Methodology

Methodology
Return Type
Description
void
Load pb files.
void
Establish a connection.
Response
Execute a method.
close()
void
close connection

Samples

Create a gRPC Client and use it:
import grpc from 'pts/grpc';

// Create a grpc Client.
const client = new grpc.Client();

// Load the addsvc.proto file from the root directory of the protocol file.
client.load([], 'addsvc.proto');

export default () => {
// Establish a connection.
client.connect('grpcb.in:9000', { insecure: true });

// Call the method.
const rsp = client.invoke('addsvc.Add/Sum', {
a: 1,
b: 2,
});
console.log(rsp.data.v); // 3

// Close the connection.
client.close();
};

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support