Reputation: 133
I am creating gRPC client in PHP through these steps
Code of Creating a client object.
simple or authorization method
$client = new Routeguide\RouteGuideClient('localhost:50051', [
'credentials' => Grpc\ChannelCredentials::createInsecure(),
]);
Authenticate with Google
function updateAuthMetadataCallback($context)
{
$auth_credentials = ApplicationDefaultCredentials::getCredentials();
return $auth_credentials->updateMetadata($metadata = [], $context->service_url);
}
$channel_credentials = Grpc\ChannelCredentials::createComposite(
Grpc\ChannelCredentials::createSsl(file_get_contents('roots.pem')),
Grpc\CallCredentials::createFromPlugin('updateAuthMetadataCallback')
);
$opts = [
'credentials' => $channel_credentials
];
$client = new helloworld\GreeterClient('greeter.googleapis.com', $opts);
now my question is How to set gRPC Request Timeout in these two methods
I am follow these links
https://grpc.io/docs/tutorials/basic/php.html
https://grpc.io/docs/guides/auth.html#php
Upvotes: 2
Views: 2799
Reputation: 353
You can try set the 'timeout' in options when sending the request. eg: $client->UnaryCall($argument, $metadata, $options)
Upvotes: 1