Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/k6/next/javascript-api/k6-net-grpc/client/client-async-invoke.md (append .md) or send Accept: text/markdown to /docs/k6/next/javascript-api/k6-net-grpc/client/client-async-invoke/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
Client.asyncInvoke(url, request [,params])
Asynchronously invokes an unary RPC request to the given method.
The given method to invoke must have its RPC schema previously loaded via the Client.load() function, otherwise an error will be thrown.
Client.connect() must be called first before invoking a request, otherwise an error will be thrown.
| Parameter | Type | Description |
|---|---|---|
| url | string | The gRPC method URL to invoke, in the form /package.Service/Method, e.g. /google.cloud.language.v1.LanguageService/AnalyzeSentiment. The leading slash / is optional. |
| request | object | The canonical request object, as-per the Protobuf JSON Mapping. |
| params (optional) | object | Params object containing additional request parameters. |
Returns
| Type | Description |
|---|---|
Promise with Response | gRPC Response object. |
Examples
import grpc from 'k6/net/grpc';
import { check } from 'k6';
const client = new grpc.Client();
client.load([], 'routeguide.proto');
export default () => {
client.connect('localhost:10000', { plaintext: true });
client
.asyncInvoke('main.RouteGuide/GetFeature', {
latitude: 410248224,
longitude: -747127767,
})
.then((response) => {
check(response, { 'status is OK': (r) => r && r.status === grpc.StatusOK });
console.log(response.message.name);
// output: 3 Hasta Way, Newton, NJ 07860, USA
client.close();
});
};Was this page helpful?
Related resources from Grafana Labs

