Clients - grpc : Caller

Provides the gRPC remote functions for interacting with caller.

Remote Methods

send

Sends the outbound response to the caller.

complete

Informs the caller, when the server has sent all the messages.

sendError

Sends a server error to the caller.

Methods

Returns the unique identification of the caller.

Checks whether the connection is closed by the caller.

Fields

  • remoteDetails Remote (default {})
  • The remote details

  • local Local (default {})
  • The local details

send

(anydata res, Headers? headers)

returns Error?

Sends the outbound response to the caller.

 grpc:Error? err = caller->send(message, headers);

Parameters

  • res anydata
    • The outbound response message

  • headers Headers? (default ())
    • Optional headers parameter. The header values are passed only if needed. The default value is ()

  • Return Type

    (Error?)
    • A grpc:Error if an error occurs while sending the response or else ()

complete

()

returns Error?

Informs the caller, when the server has sent all the messages.

 grpc:Error? result = caller->complete();
  • Return Type

    (Error?)
  • A grpc:Error if an error occurs while sending the response or else ()

sendError

(int statusCode, string message, Headers? headers)

returns Error?

Sends a server error to the caller.

 grpc:Error? result = caller->sendError(grpc:ABORTED, "Operation aborted", headers);

Parameters

  • statusCode int
  • Error status code

  • message string
  • Error message

  • headers Headers? (default ())
  • Optional headers parameter. The header values are passed only if needed. The default value is ()

  • Return Type

    (Error?)
  • A grpc:Error if an error occurs while sending the response or else ()

getId

()

returns int

Returns the unique identification of the caller.

 int result = caller.getId();
  • Return Type

    (int)
  • caller ID

isCancelled

()

returns boolean

Checks whether the connection is closed by the caller.

 boolean result = caller.isCancelled();
  • Return Type

    (boolean)
  • True if the caller has already closed the connection or else false