Overview

Namespaces

  • Grpc

Classes

  • AbstractCall
  • BaseStub
  • BidiStreamingCall
  • ClientStreamingCall
  • ServerStreamingCall
  • UnaryCall
  • Overview
  • Namespace
  • Class

Class BaseStub

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

Namespace: Grpc
Located at BaseStub.php
Methods summary
public
# __construct( string $hostname, array $opts, Grpc\Channel $channel = null )

Parameters

$hostname
$opts
  • 'update_metadata': (optional) a callback function which takes in a metadata array, and returns an updated metadata array
    • 'grpc.primary_user_agent': (optional) a user-agent string
$channel
An already created Channel object (optional)
public string
# getTarget( )

Returns

string
The URI of the endpoint
public integer
# getConnectivityState( boolean $try_to_connect = false )

Parameters

$try_to_connect
(optional)

Returns

integer
The grpc connectivity state
public boolean
# waitForReady( integer $timeout )

Parameters

$timeout
in microseconds

Returns

boolean
true if channel is ready

Throw

Exception if channel is in FATAL_ERROR state
public
# close( )

Close the communication channel associated with this stub.

Close the communication channel associated with this stub.

protected SimpleSurfaceActiveCall
# _simpleRequest( string $method, mixed $argument, callable $deserialize, array $metadata = [], array $options = [] )

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

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

Parameters

$method
The name of the method to call
$argument
The argument to the method
$deserialize
A function that deserializes the response
$metadata

A metadata map to send to the server (optional)

$options
An array of options (optional)

Returns

SimpleSurfaceActiveCall
The active call object
protected ClientStreamingSurfaceActiveCall
# _clientStreamRequest( string $method, callable $deserialize, array $metadata = [], array $options = [] )

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

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

Parameters

$method
The name of the method to call
$deserialize
A function that deserializes the response
$metadata

A metadata map to send to the server (optional)

$options
An array of options (optional)

Returns

ClientStreamingSurfaceActiveCall
The active call object
protected ServerStreamingSurfaceActiveCall
# _serverStreamRequest( string $method, mixed $argument, callable $deserialize, array $metadata = [], array $options = [] )

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

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

Parameters

$method
The name of the method to call
$argument
The argument to the method
$deserialize
A function that deserializes the responses
$metadata

A metadata map to send to the server (optional)

$options
An array of options (optional)

Returns

ServerStreamingSurfaceActiveCall
The active call object
protected BidiStreamingSurfaceActiveCall
# _bidiRequest( string $method, callable $deserialize, array $metadata = [], array $options = [] )

Call a remote method with messages streaming in both directions.

Call a remote method with messages streaming in both directions.

Parameters

$method
The name of the method to call
$deserialize
A function that deserializes the responses
$metadata

A metadata map to send to the server (optional)

$options
An array of options (optional)

Returns

BidiStreamingSurfaceActiveCall
The active call object
API documentation generated by ApiGen