Class grpc_client.Client
Fields
conn
conn
: grpc_client.h2.Conn
loop
loop
: grpc_client.cqueues.Loop
Functions
method unary_request
function grpc_client.Client:unary_request(request_specifier: grpc_client.RequestSpecifier, data: table)
-> response: table | nil, error: string | nil
Perform a unary request.
Parameters
request_specifier
: grpc_client.RequestSpecifier
data
: table
- The message to send. This should be in the structure of request_specifier.request
.
Returns
response
:table | nil
- The response as a table in the structure ofrequest_specifier.response
, ornil
if there is an error.error
:string | nil
- An error string, if any.
method server_streaming_request
function grpc_client.Client:server_streaming_request(request_specifier: grpc_client.RequestSpecifier, data: table, callback: fun(response: table))
-> error: string | nil
Performs a server-streaming request.
callback
will be called with every streamed response.
Parameters
request_specifier
: grpc_client.RequestSpecifier
data
: table
- The message to send. This should be in the structure of request_specifier.request
.callback
: fun(response: table)
- A callback that will be run with every response
Returns
error
:string | nil
- An error string, if any.
method bidirectional_streaming_request
function grpc_client.Client:bidirectional_streaming_request(request_specifier: grpc_client.RequestSpecifier, callback: fun(response: table, stream: grpc_client.h2.Stream))
-> grpc_client.h2.Stream | nil, error: string | nil
Performs a bidirectional-streaming request.
callback
will be called with every streamed response.
The raw client-to-server stream is returned to allow you to send encoded messages.
Parameters
request_specifier
: grpc_client.RequestSpecifier
callback
: fun(response: table, stream: grpc_client.h2.Stream)
- A callback that will be run with every response
Returns
grpc_client.h2.Stream | nil
error
:string | nil
- An error string, if any.