\GrpcBaseStub

Base class for generated client stubs. Stub methods are expected to call _simpleRequest or _streamRequest and return the result.

Summary

Methods
Properties
Constants
__construct()
getTarget()
getConnectivityState()
waitForReady()
close()
_simpleRequest()
_clientStreamRequest()
_serverStreamRequest()
_bidiRequest()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
_checkConnectivityState()
_get_jwt_aud_uri()
_extract_timeout_from_metadata()
$hostname
$channel
$update_metadata
N/A

Properties

$hostname

$hostname : 

Type

$channel

$channel : 

Type

$update_metadata

$update_metadata : 

Type

Methods

__construct()

__construct(  $hostname,   $opts) 

Parameters

$hostname

string

$opts

array

  • 'update_metadata': (optional) a callback function which takes in a metadata array, and returns an updated metadata array

getTarget()

getTarget() : string

Returns

string —

The URI of the endpoint.

getConnectivityState()

getConnectivityState(  $try_to_connect = false) : integer

Parameters

$try_to_connect

bool

Returns

integer —

The grpc connectivity state

waitForReady()

waitForReady(  $timeout) : boolean

Parameters

$timeout

in microseconds

Throws

\Grpc\Exception

if channel is in FATAL_ERROR state

Returns

boolean —

true if channel is ready

close()

close() 

Close the communication channel associated with this stub

_simpleRequest()

_simpleRequest(string  $method,   $argument, callable  $deserialize, array  $metadata = array()) : \Grpc\SimpleSurfaceActiveCall

Call a remote method that takes a single argument and has a single output

Parameters

string $method

The name of the method to call

$argument

The argument to the method

callable $deserialize

A function that deserializes the response

array $metadata

A metadata map to send to the server

Returns

\Grpc\SimpleSurfaceActiveCall —

The active call object

_clientStreamRequest()

_clientStreamRequest(string  $method,   $arguments, callable  $deserialize, array  $metadata = array()) : \Grpc\ClientStreamingSurfaceActiveCall

Call a remote method that takes a stream of arguments and has a single output

Parameters

string $method

The name of the method to call

$arguments

An array or Traversable of arguments to stream to the server

callable $deserialize

A function that deserializes the response

array $metadata

A metadata map to send to the server

Returns

\Grpc\ClientStreamingSurfaceActiveCall —

The active call object

_serverStreamRequest()

_serverStreamRequest(string  $method,   $argument, callable  $deserialize, array  $metadata = array()) : \Grpc\ServerStreamingSurfaceActiveCall

Call a remote method that takes a single argument and returns a stream of responses

Parameters

string $method

The name of the method to call

$argument

The argument to the method

callable $deserialize

A function that deserializes the responses

array $metadata

A metadata map to send to the server

Returns

\Grpc\ServerStreamingSurfaceActiveCall —

The active call object

_bidiRequest()

_bidiRequest(string  $method, callable  $deserialize, array  $metadata = array()) : \Grpc\BidiStreamingSurfaceActiveCall

Call a remote method with messages streaming in both directions

Parameters

string $method

The name of the method to call

callable $deserialize

A function that deserializes the responses

array $metadata

A metadata map to send to the server

Returns

\Grpc\BidiStreamingSurfaceActiveCall —

The active call object

_checkConnectivityState()

_checkConnectivityState(  $new_state) 

Parameters

$new_state

_get_jwt_aud_uri()

_get_jwt_aud_uri(  $method) 

constructs the auth uri for the jwt

Parameters

$method

_extract_timeout_from_metadata()

_extract_timeout_from_metadata(  $metadata) : \Grpc\list($metadata_copy,

extract $timeout from $metadata

Parameters

$metadata

The metadata map

Returns

\Grpc\list($metadata_copy, —

$timeout)